/* ============================================================
   WhatsApp Floating Widget
   ============================================================ */

/* ── Widget container ── */
.wa-widget {
    position: fixed;
    bottom: 28px;
    right: 28px;
    z-index: 9998;
    display: flex;
    align-items: flex-end;
    flex-direction: column;
    gap: 12px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.45s cubic-bezier(0.4, 0, 0.2, 1), transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none;
}

.wa-widget.wa-visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

/* ── Toggle Button ── */
.wa-btn {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #25D366;
    color: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 20px rgba(37, 211, 102, 0.4);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    flex-shrink: 0;
    align-self: flex-end;
    -webkit-tap-highlight-color: transparent;
}

.wa-btn::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    border: 2px solid rgba(37, 211, 102, 0.45);
    animation: wa-pulse 2.4s infinite;
    pointer-events: none;
}

@keyframes wa-pulse {
    0%   { transform: scale(1);   opacity: 0.8; }
    50%  { transform: scale(1.28); opacity: 0; }
    100% { transform: scale(1.28); opacity: 0; }
}

.wa-btn:hover {
    transform: scale(1.07);
    box-shadow: 0 6px 28px rgba(37, 211, 102, 0.55);
    background: #20bd5a;
}

.wa-btn:active {
    transform: scale(0.95);
    transition: transform 0.12s ease;
}

.wa-btn-active {
    background: #1a1a1a !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3) !important;
}

.wa-btn-active::after { animation: none; }
.wa-btn-active:hover { background: #2a2a2a !important; }

.wa-btn-icon { transition: opacity 0.25s ease, transform 0.25s ease; }
.wa-btn-icon i { font-size: 30px; display: block; }

.wa-btn-close {
    position: absolute;
    inset: 0;
    display: flex; align-items: center; justify-content: center;
    opacity: 0;
    transform: rotate(-90deg) scale(0.6);
}
.wa-btn-close i { font-size: 22px; }

.wa-btn-active .wa-btn-open   { opacity: 0; transform: rotate(90deg) scale(0.6); }
.wa-btn-active .wa-btn-close  { opacity: 1; transform: rotate(0deg) scale(1); }

/* ── Compact state (on scroll) ── */
.wa-btn.wa-btn-compact {
    width: 48px;
    height: 48px;
}
.wa-btn.wa-btn-compact .wa-btn-icon i { font-size: 24px; }

/* ── Button label ── */
.wa-btn-label {
    position: absolute;
    right: 72px;
    top: 50%;
    transform: translateY(-50%);
    background: #fff;
    color: #1a1a1a;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 500;
    font-family: var(--font-body);
    box-shadow: 0 2px 14px rgba(0,0,0,0.1);
    white-space: nowrap;
    pointer-events: none;
    transition: opacity 0.35s ease;
}

/* ── Chat Popup ── */
.wa-popup {
    position: absolute;
    bottom: 74px;
    right: 0;
    width: 340px;
    max-height: 460px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 36px rgba(0,0,0,0.16), 0 2px 8px rgba(0,0,0,0.06);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transform: translateY(12px) scale(0.94);
    pointer-events: none;
    transition: opacity 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: bottom right;
}

.wa-popup.wa-popup-open {
    opacity: 1;
    transform: translateY(0) scale(1);
    pointer-events: auto;
}

/* ── Popup Header ── */
.wa-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 18px;
    background: linear-gradient(135deg, #075e54 0%, #128c7e 100%);
    color: #fff;
}

.wa-popup-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.wa-popup-brand img {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255,255,255,0.3);
}

.wa-popup-brand strong {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: var(--font-heading);
}

.wa-popup-brand small {
    font-size: 0.7rem;
    opacity: 0.85;
}

.wa-popup-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: rgba(255,255,255,0.15);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    flex-shrink: 0;
}
.wa-popup-close:hover { background: rgba(255,255,255,0.25); }

/* ── Popup Body ── */
.wa-popup-body {
    padding: 16px 18px;
    overflow-y: auto;
    flex: 1;
    background: #efeae3;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(0,0,0,0.015) 0%, transparent 50%);
}

.wa-greeting {
    background: #fff;
    padding: 12px 14px;
    border-radius: 10px 10px 10px 2px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    position: relative;
}
.wa-greeting p {
    margin: 0;
    font-size: 0.82rem;
    line-height: 1.55;
    color: #333;
}

/* ── Department Cards ── */
.wa-departments {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.wa-dept-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #888;
    padding-left: 2px;
    margin-bottom: 2px;
    font-weight: 600;
}

.wa-dept-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #fff;
    border-radius: 10px;
    text-decoration: none;
    color: inherit;
    transition: all 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    cursor: pointer;
}

.wa-dept-card:hover {
    background: #f0faf5;
    transform: translateX(3px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.wa-dept-icon {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #dcf8c6;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #25D366;
    font-size: 1rem;
    flex-shrink: 0;
    transition: background 0.2s;
}

.wa-dept-card:hover .wa-dept-icon {
    background: #c8f0ad;
}

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

.wa-dept-info strong {
    display: block;
    font-size: 0.82rem;
    font-weight: 600;
    color: #1a1a1a;
}

.wa-dept-info small {
    font-size: 0.7rem;
    color: #888;
}

.wa-dept-arrow {
    color: #25D366;
    font-size: 0.8rem;
    transition: transform 0.2s;
    flex-shrink: 0;
}
.wa-dept-card:hover .wa-dept-arrow {
    transform: translateX(4px);
}

/* ── Popup Footer ── */
.wa-popup-footer {
    padding: 10px 18px;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

.wa-popup-footer small {
    font-size: 0.68rem;
    color: #aaa;
}

.wa-popup-footer i {
    font-size: 0.6rem;
    margin-right: 3px;
}

/* ── Mobile Adjustments ── */
@media (max-width: 768px) {
    .wa-widget {
        bottom: 20px;
        right: 16px;
        gap: 10px;
    }
    .wa-btn {
        width: 54px;
        height: 54px;
    }
    .wa-btn-icon i { font-size: 27px; }
    .wa-btn-close i { font-size: 20px; }

    .wa-btn-label {
        right: 64px;
        font-size: 0.76rem;
        padding: 7px 13px;
    }

    .wa-popup {
        width: calc(100vw - 32px);
        max-width: 340px;
        right: -8px;
        bottom: 68px;
        max-height: 420px;
    }
}

@media (max-width: 480px) {
    .wa-widget {
        bottom: 14px;
        right: 10px;
    }
    .wa-btn {
        width: 50px;
        height: 50px;
    }
    .wa-btn-icon i { font-size: 25px; }

    .wa-btn-label { display: none; }

    .wa-popup {
        width: calc(100vw - 20px);
        max-width: 320px;
        right: -4px;
        bottom: 62px;
        max-height: 380px;
        border-radius: 12px;
    }

    .wa-popup-header { padding: 12px 14px; }
    .wa-popup-brand strong { font-size: 0.82rem; }
    .wa-popup-body { padding: 12px 14px; }
}
