.whatsapp-float {
    position: fixed;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10001;
    margin: 0;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-family: var(--font);
}

.whatsapp-float-inner {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 10px;
    background: var(--blue);
    color: var(--text-inv);
    border: 1px solid var(--blue-mid);
    border-right: none;
    border-radius: var(--r-md) 0 0 var(--r-md);
    box-shadow: var(--shadow-md), 0 0 0 0 var(--blue-dim);
    transition: background 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
    animation: whatsapp-tab-pulse 2.5s ease-in-out infinite;
}

.whatsapp-float-label {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.06em;
    line-height: 1;
    white-space: nowrap;
}

.whatsapp-float-icon-open,
.whatsapp-float-icon-close {
    font-size: 16px;
    line-height: 1;
}

.whatsapp-float-icon-close {
    display: none;
}

.whatsapp-widget.is-open .whatsapp-float-inner {
    background: var(--accent);
    border-color: var(--border-3);
    animation: none;
}

.whatsapp-widget.is-open .whatsapp-float-icon-open {
    display: none;
}

.whatsapp-widget.is-open .whatsapp-float-icon-close {
    display: block;
}

.whatsapp-float:hover .whatsapp-float-inner {
    filter: brightness(1.08);
    box-shadow: var(--shadow-lg);
}

.whatsapp-float:focus-visible .whatsapp-float-inner {
    outline: 2px solid var(--accent-primary);
    outline-offset: 3px;
}

.whatsapp-chat {
    position: fixed;
    top: 50%;
    right: 52px;
    left: auto;
    width: 340px;
    max-width: calc(100vw - 80px);
    z-index: 10000;
    background: var(--surface-1);
    border: 1px solid var(--border-2);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    opacity: 0;
    transform: translateY(-50%) translateX(12px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}

.whatsapp-widget.is-open .whatsapp-chat {
    opacity: 1;
    transform: translateY(-50%) translateX(0);
    pointer-events: auto;
    visibility: visible;
}

.whatsapp-chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    background: var(--surface-3);
    border-bottom: 1px solid var(--border-2);
    color: var(--text-1);
}

.whatsapp-chat-header-info {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.whatsapp-chat-avatar {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: var(--r-pill);
    background: var(--blue-dim);
    color: var(--blue);
    flex-shrink: 0;
}

.whatsapp-chat-avatar i {
    font-size: 1.35rem;
}

.whatsapp-chat-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.2;
    color: var(--text-1);
}

.whatsapp-chat-subtitle {
    margin: 2px 0 0;
    font-size: 0.75rem;
    color: var(--text-2);
    line-height: 1.2;
}

.whatsapp-chat-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    border-radius: var(--r-pill);
    background: transparent;
    color: var(--text-2);
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s ease, color 0.15s ease;
}

.whatsapp-chat-close:hover {
    background: var(--surface-2);
    color: var(--text-1);
}

.whatsapp-chat-close:focus-visible {
    outline: 2px solid var(--accent-primary);
    outline-offset: 2px;
}

.whatsapp-chat-body {
    padding: 16px;
    background: var(--surface-1);
}

.whatsapp-chat-intro {
    margin: 0 0 14px;
    font-size: 0.8125rem;
    line-height: 1.45;
    color: var(--text-2);
}

.whatsapp-chat-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.whatsapp-chat-form .form-group {
    margin: 0;
}

.whatsapp-chat-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-2);
    border-radius: var(--r-md);
    background: var(--surface-2);
    color: var(--text-1);
    font-family: var(--font);
    font-size: 0.875rem;
    line-height: 1.4;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.whatsapp-chat-input::placeholder {
    color: var(--text-3);
}

.whatsapp-chat-input:focus {
    outline: none;
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--accent-dim);
}

.whatsapp-chat-textarea {
    resize: vertical;
    min-height: 96px;
}

.whatsapp-chat-error {
    margin: 0;
    font-size: 0.8125rem;
}

.whatsapp-chat-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
}

@keyframes whatsapp-tab-pulse {
    0%, 100% {
        box-shadow: var(--shadow-md), 0 0 0 0 var(--blue-dim);
    }
    50% {
        box-shadow: var(--shadow-md), 0 0 0 10px transparent;
    }
}

@media (max-width: 768px) {
    .whatsapp-float {
        top: auto;
        bottom: 96px;
        transform: none;
    }

    .whatsapp-float-inner {
        padding: 12px 8px;
    }

    .whatsapp-float-label {
        font-size: 11px;
    }

    .whatsapp-chat {
        top: auto;
        bottom: 150px;
        right: 12px;
        width: calc(100vw - 24px);
        max-width: 340px;
        transform: translateX(12px);
    }

    .whatsapp-widget.is-open .whatsapp-chat {
        transform: translateX(0);
    }
}
