/* ==============================
   ANB WhatsApp Widget v2.2
   Front + admin
   ============================== */

.anb-wa-widget,
.anb-wa-widget *,
.anb-wa-admin,
.anb-wa-admin * {
    box-sizing: border-box;
}

.anb-wa-widget {
    --anb-wa-color: #25D366;
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 999999;
    width: min(350px, calc(100vw - 32px));
    font-family: inherit;
    color: #1f2933;
    line-height: 1.35;
}

.anb-wa-left {
    left: 24px;
    right: auto;
}

.anb-wa-chat {
    position: absolute;
    right: 0;
    bottom: 86px;
    width: 100%;
    overflow: hidden;
    background: rgba(255, 255, 255, .98);
    border: 1px solid rgba(15, 23, 42, .07);
    border-radius: 26px;
    box-shadow: 0 24px 70px rgba(15, 23, 42, .18), 0 8px 24px rgba(15, 23, 42, .08);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    transform-origin: bottom right;
    animation: anbWaIn .35s cubic-bezier(.2, .85, .25, 1.2);
}

.anb-wa-left .anb-wa-chat {
    left: 0;
    right: auto;
    transform-origin: bottom left;
}

.anb-wa-closed .anb-wa-chat,
.anb-wa-chat.is-hidden {
    display: none;
}

.anb-wa-close {
    position: absolute;
    top: 13px;
    right: 14px;
    z-index: 3;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #667085;
    font-size: 28px;
    line-height: 28px;
    cursor: pointer;
    transition: background .2s, color .2s, transform .2s;
}

.anb-wa-close:hover {
    background: #f2f4f7;
    color: #111827;
    transform: rotate(90deg);
}

.anb-wa-chat-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 54px 17px 20px;
    background: linear-gradient(135deg, var(--anb-wa-color), #12b957);
    color: #fff;
}

.anb-wa-avatar {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    min-width: 46px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .18);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22);
}

.anb-wa-chat-head strong {
    display: block;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.anb-wa-chat-head span {
    display: block;
    margin-top: 2px;
    font-size: 13px;
    font-weight: 500;
    opacity: .94;
}

.anb-wa-chat-body {
    padding: 20px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.anb-wa-message {
    position: relative;
    max-width: 92%;
    margin: 0 0 14px;
    padding: 13px 15px;
    border-radius: 17px 17px 17px 5px;
    background: #eef8f1;
    color: #263238;
    font-size: 16px;
    line-height: 1.45;
}

.anb-wa-hours {
    margin: 0 0 12px;
    color: #667085;
    font-size: 13px;
}

.anb-wa-input {
    display: block;
    width: 100%;
    min-height: 84px;
    max-height: 150px;
    margin: 0 0 12px;
    padding: 13px 14px;
    resize: vertical;
    outline: none;
    border: 1px solid #d0d5dd;
    border-radius: 17px;
    background: #fff;
    color: #1f2937;
    font-family: inherit;
    font-size: 15px;
    line-height: 1.35;
    transition: border .18s, box-shadow .18s;
}

.anb-wa-input:focus {
    border-color: var(--anb-wa-color);
    box-shadow: 0 0 0 4px rgba(37, 211, 102, .13);
}

.anb-wa-send {
    width: 100%;
    min-height: 56px;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--anb-wa-color), #12b957);
    color: #fff !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 17px;
    font-weight: 800;
    box-shadow: 0 12px 30px rgba(37, 211, 102, .28);
    transition: transform .22s, box-shadow .22s, filter .22s;
}

.anb-wa-send:hover {
    transform: translateY(-2px);
    filter: saturate(1.06);
    box-shadow: 0 16px 38px rgba(37, 211, 102, .36);
}

.anb-wa-fab {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 70px;
    height: 70px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--anb-wa-color), #12b957);
    color: #fff;
    display: grid;
    place-items: center;
    box-shadow: 0 16px 38px rgba(10, 110, 49, .28), 0 6px 16px rgba(0, 0, 0, .18);
    cursor: pointer;
    transition: transform .22s, box-shadow .22s, filter .22s;
    overflow: visible;
}

.anb-wa-left .anb-wa-fab {
    left: 0;
    right: auto;
}

.anb-wa-fab:hover {
    transform: translateY(-3px) scale(1.03);
    filter: saturate(1.08);
    box-shadow: 0 20px 45px rgba(10, 110, 49, .35), 0 8px 20px rgba(0, 0, 0, .2);
}

.anb-wa-glow {
    position: absolute;
    inset: -10px;
    z-index: -1;
    border-radius: inherit;
    background: var(--anb-wa-color);
    opacity: .18;
    filter: blur(1px);
    animation: anbWaGlow 2.6s ease-in-out infinite;
}

/* Protecció anti-temes: cap CSS del theme/SiteOrigin pot fer la icona gegant */
.anb-wa-icon {
    display: block !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    max-width: 28px !important;
    min-height: 28px !important;
    max-height: 28px !important;
    flex: 0 0 28px !important;
    color: currentColor;
    fill: currentColor;
}

.anb-wa-fab .anb-wa-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    flex-basis: 42px !important;
}

.anb-wa-avatar .anb-wa-icon {
    width: 29px !important;
    height: 29px !important;
    min-width: 29px !important;
    max-width: 29px !important;
    min-height: 29px !important;
    max-height: 29px !important;
    flex-basis: 29px !important;
}

.anb-wa-send .anb-wa-icon {
    width: 25px !important;
    height: 25px !important;
    min-width: 25px !important;
    max-width: 25px !important;
    min-height: 25px !important;
    max-height: 25px !important;
    flex-basis: 25px !important;
}

.anb-wa-fab.anb-wa-pulse {
    animation: anbWaPulse .82s cubic-bezier(.2, .8, .2, 1);
}

@keyframes anbWaIn {
    from {
        opacity: 0;
        transform: translateY(14px) scale(.96);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@keyframes anbWaPulse {
    0%, 100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }
}

@keyframes anbWaGlow {
    0%, 100% {
        transform: scale(.98);
        opacity: .14;
    }

    50% {
        transform: scale(1.08);
        opacity: .26;
    }
}

@media (max-width: 767px) {
    .anb-wa-widget {
        right: 16px;
        bottom: 16px;
        width: min(330px, calc(100vw - 32px));
    }

    .anb-wa-left {
        left: 16px;
        right: auto;
    }

    .anb-wa-chat {
        bottom: 76px;
        border-radius: 22px;
    }

    .anb-wa-chat-head {
        padding: 17px 50px 15px 17px;
    }

    .anb-wa-chat-body {
        padding: 17px;
    }

    .anb-wa-message {
        font-size: 15px;
    }

    .anb-wa-fab {
        width: 62px;
        height: 62px;
    }

    .anb-wa-fab .anb-wa-icon {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        max-width: 38px !important;
        min-height: 38px !important;
        max-height: 38px !important;
        flex-basis: 38px !important;
    }

    .anb-wa-hide-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .anb-wa-hide-desktop {
        display: none !important;
    }
}

/* ==============================
   Admin
   ============================== */

.anb-wa-admin {
    max-width: 1220px;
}

.anb-wa-admin h1 {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 24px 0;
}

.anb-wa-admin h1 span {
    padding: 6px 9px;
    border-radius: 999px;
    background: #dcfce7;
    color: #078c3d;
    font-size: 12px;
    font-weight: 800;
}

.anb-wa-admin-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 390px;
    gap: 22px;
    align-items: start;
}

.anb-wa-admin-card {
    background: #fff;
    border: 1px solid #dcdcde;
    border-radius: 18px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .04);
}

.anb-wa-admin-card h2 {
    margin: 0 0 18px;
    font-size: 18px;
}

.anb-wa-admin-card hr {
    margin: 24px 0;
    border: 0;
    border-top: 1px solid #e5e7eb;
}

.anb-wa-admin-card label {
    display: block;
    margin: 0 0 16px;
    font-weight: 650;
}

.anb-wa-admin-card input[type="text"],
.anb-wa-admin-card input[type="color"],
.anb-wa-admin-card textarea,
.anb-wa-admin-card select {
    display: block;
    width: 100%;
    max-width: none;
    margin-top: 7px;
    border-radius: 9px;
    border-color: #d0d5dd;
}

.anb-wa-admin-card input[type="color"] {
    height: 42px;
    padding: 4px;
}

.anb-wa-admin-card small {
    display: block;
    margin-top: 6px;
    color: #667085;
    font-weight: 400;
}

.anb-wa-admin-check {
    display: flex !important;
    gap: 9px;
    align-items: center;
}

.anb-wa-admin-check input {
    margin: 0;
}

.anb-wa-admin-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.anb-wa-admin-grid-3 {
    grid-template-columns: 1fr 1fr 1fr;
}

.anb-wa-admin-checks {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 18px;
    margin: 8px 0 22px;
}

.anb-wa-admin-checks label {
    margin: 0;
    font-weight: 500;
}

.anb-wa-admin-preview {
    position: sticky;
    top: 46px;
}

.anb-wa-preview-area {
    position: relative;
    min-height: 500px;
    overflow: hidden;
    border-radius: 22px;
    background: linear-gradient(135deg, #f8fafc, #eef2f7);
    padding: 22px;
}

.anb-wa-preview-chat {
    position: relative;
    right: auto;
    bottom: auto;
    width: 100%;
    animation: none;
}

.anb-wa-preview-fab {
    position: absolute;
    right: 30px;
    bottom: 28px;
    display: grid;
    place-items: center;
    width: 70px;
    height: 70px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--anb-wa-color), #12b957);
    color: #fff;
    box-shadow: 0 16px 38px rgba(10, 110, 49, .25);
}

.anb-wa-preview-fab .anb-wa-icon {
    width: 42px !important;
    height: 42px !important;
    min-width: 42px !important;
    max-width: 42px !important;
}

.anb-wa-clicks {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 18px 0;
    padding: 16px;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    background: #f8fafc;
}

.anb-wa-clicks span {
    color: #667085;
}

.anb-wa-clicks strong {
    font-size: 32px;
}

.anb-wa-admin-preview code {
    display: block;
    margin: 8px 0;
    padding: 8px;
    border-radius: 8px;
    background: #ecfdf5;
    color: #047857;
    white-space: normal;
}

@media (max-width: 960px) {
    .anb-wa-admin-layout,
    .anb-wa-admin-grid,
    .anb-wa-admin-grid-3,
    .anb-wa-admin-checks {
        grid-template-columns: 1fr;
    }

    .anb-wa-admin-preview {
        position: static;
    }
}
