:root {
    --tsxsoft-wa-green: #25D366;
    --tsxsoft-wa-green-dark: #128C7E;
    --tsxsoft-wa-text: #172033;
    --tsxsoft-wa-muted: #64748b;
    --tsxsoft-wa-border: #e2e8f0;
    --tsxsoft-wa-blue: #2563eb;
}

.tsxsoft-wa-root {
    --tsxsoft-wa-side: 25px;
    position: relative;
    z-index: 999999;
}

.tsxsoft-wa-position-right .tsxsoft-wa-float {
    right: var(--tsxsoft-wa-side);
}

.tsxsoft-wa-position-left .tsxsoft-wa-float {
    left: var(--tsxsoft-wa-side);
}

.tsxsoft-wa-float {
    position: fixed;
    bottom: 25px;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tsxsoft-wa-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 22px rgba(37, 211, 102, .32);
    transition: transform .25s ease, background .25s ease, opacity .25s ease;
    animation: tsxsoft-wa-pulse 2s infinite;
}

.tsxsoft-wa-float:hover,
.tsxsoft-wa-float:focus-visible {
    transform: scale(1.08);
    background: var(--tsxsoft-wa-green-dark);
    outline: none;
}

.tsxsoft-wa-icon svg {
    width: 34px;
    height: 34px;
    fill: currentColor;
}

.tsxsoft-wa-tooltip {
    position: absolute;
    right: 74px;
    top: 50%;
    transform: translateY(-50%) translateX(8px);
    background: #172033;
    color: #fff;
    padding: 10px 14px;
    border-radius: 8px;
    white-space: nowrap;
    font: 600 14px/1.2 system-ui, sans-serif;
    opacity: 0;
    visibility: hidden;
    transition: opacity .2s ease, transform .2s ease;
    pointer-events: none;
}

.tsxsoft-wa-position-left .tsxsoft-wa-tooltip {
    left: 74px;
    right: auto;
    transform: translateY(-50%) translateX(-8px);
}

.tsxsoft-wa-float:hover .tsxsoft-wa-tooltip,
.tsxsoft-wa-float:focus-visible .tsxsoft-wa-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) translateX(0);
}

.tsxsoft-wa-modal {
    position: fixed;
    inset: auto;
    bottom: 105px;
    right: 25px;
    display: none;
    width: 350px;
    max-width: calc(100vw - 40px);
    padding: 0;
    z-index: 1000000;
}

.tsxsoft-wa-modal.is-open {
    display: block;
}

.tsxsoft-wa-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .58);
}

.tsxsoft-wa-dialog {
    position: relative;
    width: min(400px, 100%);
    max-height: calc(100vh - 40px);
    overflow: auto;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 20px 70px rgba(0,0,0,.25);
    animation: tsxsoft-wa-slide-up .25s ease;
}

tsxsoft-wa-float {
    position: fixed;
    bottom: 25px;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--tsxsoft-wa-green);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 5px 22px rgba(37, 211, 102, .32);
    transition: transform .25s ease, background .25s ease, opacity .25s ease;
    animation: tsxsoft-wa-pulse 2s infinite;
}
.tsxsoft-wa-close {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #d11515;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
}

.tsxsoft-wa-close:hover,
.tsxsoft-wa-close:focus-visible {
    background: rgba(255,255,255,.2);
    outline: none;
}

.tsxsoft-wa-body {
    padding: 24px;
}

.tsxsoft-wa-intro {
    margin: 0 0 18px;
    color: var(--tsxsoft-wa-muted);
    text-align: center;
    font: 400 15px/1.5 system-ui, sans-serif;
}

.tsxsoft-wa-options {
    display: grid;
    gap: 10px;
}

.tsxsoft-wa-option {
    width: 100%;
    padding: 14px 15px;
    border: 2px solid var(--tsxsoft-wa-border);
    border-radius: 10px;
    background: #f8fafc;
    color: var(--tsxsoft-wa-text);
    text-align: left;
    font: 600 15px/1.3 system-ui, sans-serif;
    cursor: pointer;
    transition: .2s ease;
}

.tsxsoft-wa-option span {
    display: inline-block;
    width: 28px;
}

.tsxsoft-wa-option:hover,
.tsxsoft-wa-option:focus-visible {
    border-color: var(--tsxsoft-wa-blue);
    background: var(--tsxsoft-wa-blue);
    color: #fff;
    transform: translateX(4px);
    outline: none;
}

.tsxsoft-wa-direct {
    margin-top: 22px;
    padding-top: 20px;
    border-top: 2px dashed var(--tsxsoft-wa-border);
}

.tsxsoft-wa-direct-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px;
    border-radius: 10px;
    background: var(--tsxsoft-wa-green);
    color: #fff !important;
    text-decoration: none !important;
    font: 700 15px/1.2 system-ui, sans-serif;
    transition: .2s ease;
}

.tsxsoft-wa-direct-link:hover,
.tsxsoft-wa-direct-link:focus-visible {
    background: var(--tsxsoft-wa-green-dark);
    transform: translateY(-2px);
    outline: none;
}

.tsxsoft-wa-notification {
    position: fixed;
    top: 80px;
    right: 25px;
    max-width: min(320px, calc(100vw - 40px));
    padding: 13px 17px;
    border-radius: 10px;
    background: var(--tsxsoft-wa-green);
    color: #fff;
    font: 700 14px/1.4 system-ui, sans-serif;
    box-shadow: 0 8px 25px rgba(0,0,0,.18);
    opacity: 0;
    visibility: hidden;
    transform: translateX(30px);
    transition: .25s ease;
}

.tsxsoft-wa-notification.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateX(0);
}

.tsxsoft-wa-float.tsxsoft-wa-hidden {
    opacity: 0;
    pointer-events: none;
    transform: translateY(100px);
}

@keyframes tsxsoft-wa-pulse {
    0% { box-shadow: 0 0 0 0 rgba(37,211,102,.65); }
    70% { box-shadow: 0 0 0 15px rgba(37,211,102,0); }
    100% { box-shadow: 0 0 0 0 rgba(37,211,102,0); }
}

@keyframes tsxsoft-wa-slide-up {
    from { opacity: 0; transform: translateY(25px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .tsxsoft-wa-float,
    .tsxsoft-wa-dialog,
    .tsxsoft-wa-option,
    .tsxsoft-wa-notification {
        animation: none !important;
        transition: none !important;
    }
}

@media (max-width: 768px) {
    .tsxsoft-wa-root {
        --tsxsoft-wa-side: 18px;
    }

    .tsxsoft-wa-float {
        bottom: 18px;
        width: 56px;
        height: 56px;
    }

    .tsxsoft-wa-icon svg {
        width: 30px;
        height: 30px;
    }

    .tsxsoft-wa-tooltip {
        display: none;
    }

    .tsxsoft-wa-dialog {
        width: 100%;
    }
}

/* ===== FIX: HEADER Y BOTÓN DE CERRAR ===== */
.tsxsoft-wa-header {
    position: relative;
    padding: 18px 50px 18px 24px;
    background: var(--tsxsoft-wa-green, #25D366);
    border-radius: 16px 16px 0 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 60px;
}

.tsxsoft-wa-header h2 {
    margin: 0;
    color: #ffffff !important;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
    font-family: system-ui, -apple-system, sans-serif;
}

.tsxsoft-wa-header-icon {
    display: inline-block;
    margin-right: 8px;
    color: #ffffff;
    font-size: 14px;
}

.tsxsoft-wa-close {
    position: absolute !important;
    right: 12px !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    font-size: 26px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    transition: background 0.2s ease, transform 0.2s ease !important;
}

.tsxsoft-wa-close:hover {
    background: rgba(255, 255, 255, 0.35) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

.tsxsoft-wa-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8) !important;
    outline-offset: 2px !important;
}
