/* ==========================================================================
   Apúntate WhatsApp Leads Pro — Estilos del Widget Frontend v1.3.2
   Smart Bubble System: icon_only | icon_text | delayed_text
   Arquitectura de 3 Capas: Header Fijo | Body Scroll | Footer Fijo
   Variable Global CSS: --apn-wa-radius
   Mobile Optimized: Compatible con menús inferiores Woodmart / WooCommerce
   Responsive Certified: 1920x1080, 1366x768, 768px, 390px, 375px
   ========================================================================== */

.coisa-wa-container {
    position: fixed;
    z-index: 999999;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
    text-align: left;
}

.coisa-wa-bubble-wrap {
    display: inline-flex;
    align-items: center;
}

.coisa-wa-bubble {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background-color: #0b685c;
    color: #ffffff !important;
    border: none;
    border-radius: 50px;
    padding: 8px 18px 8px 8px;
    min-height: 56px;
    min-width: 56px;
    cursor: pointer;
    box-shadow: 0 6px 25px rgba(0, 0, 0, 0.25);
    font-weight: 700;
    font-size: 14.5px;
    text-decoration: none;
    transition: transform 0.25s ease, box-shadow 0.25s ease, padding 0.3s ease, border-radius 0.3s ease;
    position: relative;
    user-select: none;
}

.coisa-wa-bubble.bubble-mode-icon,
.coisa-wa-bubble.bubble-icon-only {
    padding: 6px !important;
    width: 56px !important;
    height: 56px !important;
    border-radius: 50% !important;
    justify-content: center;
}

.coisa-wa-bubble.bubble-mode-icon .coisa-wa-bubble-label,
.coisa-wa-bubble.bubble-icon-only .coisa-wa-bubble-label {
    display: none !important;
}

.coisa-wa-bubble:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
}

.coisa-wa-bubble-icon {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #25D366;
    border-radius: 50%;
    flex-shrink: 0;
}

.coisa-wa-pulse-wave {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: #25D366;
    opacity: 0.7;
    animation: coisaWaPulse 2s infinite cubic-bezier(0.4, 0, 0.2, 1);
    z-index: -1;
    will-change: transform, opacity;
}

@keyframes coisaWaPulse {
    0% {
        transform: scale(1);
        opacity: 0.7;
    }
    70% {
        transform: scale(1.6);
        opacity: 0;
    }
    100% {
        transform: scale(1.8);
        opacity: 0;
    }
}

.coisa-wa-bubble-label {
    white-space: nowrap;
    letter-spacing: 0.2px;
    font-size: 14px;
    font-weight: 700;
}

/* Modal de Captura v1.7.0 (Estructura de 3 Capas Flex & UX Compacto) */
.coisa-wa-modal {
    display: none;
    position: absolute;
    bottom: 74px;
    width: 380px;
    max-width: 420px;
    max-height: 85vh;
    background: #ffffff;
    border-radius: var(--apn-wa-radius, 20px);
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.2);
    overflow: hidden;
    z-index: 1000000;
    border: 1px solid rgba(0, 0, 0, 0.08);
    display: none;
    flex-direction: column;
}

/* 1. Cabecera Fija (Header) */
.coisa-wa-header {
    flex-shrink: 0;
    padding: 14px 16px;
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top-left-radius: var(--apn-wa-radius, 20px);
    border-top-right-radius: var(--apn-wa-radius, 20px);
}

.coisa-wa-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.coisa-wa-avatar-img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

.coisa-wa-icon {
    flex-shrink: 0;
}

.coisa-wa-header-title {
    font-weight: 700;
    font-size: 14.5px;
    letter-spacing: 0.2px;
    color: #ffffff;
}

.coisa-wa-close-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.85;
    transition: opacity 0.2s, transform 0.2s;
}

.coisa-wa-close-btn:hover {
    opacity: 1;
    transform: scale(1.15);
}

/* 2. Cuerpo Scrollable (Body) */
.coisa-wa-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 14px 16px;
    background-color: #ffffff;
    max-height: calc(85vh - 130px);
    -webkit-overflow-scrolling: touch;
}

.coisa-wa-body::-webkit-scrollbar {
    width: 5px;
}
.coisa-wa-body::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

.coisa-wa-instruction {
    font-size: 12.5px;
    line-height: 1.4;
    color: #475569;
    margin: 0 0 12px 0;
}

.coisa-wa-field {
    margin-bottom: 10px;
}

.coisa-wa-field label {
    display: block;
    font-size: 11.5px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.coisa-wa-field input[type="text"],
.coisa-wa-field input[type="email"],
.coisa-wa-field input[type="tel"] {
    width: 100%;
    padding: 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--apn-wa-inner-radius, 8px);
    font-size: 13px;
    color: #0f172a;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
    min-height: 42px;
}

.coisa-wa-field input:focus,
.coisa-wa-field textarea:focus {
    border-color: #0b685c;
    box-shadow: 0 0 0 3px rgba(11, 104, 92, 0.12);
    background: #ffffff;
}

/* Textarea Compacto Expandible v1.7.0 */
.coisa-wa-textarea-compact {
    width: 100%;
    min-height: 44px;
    height: 48px;
    max-height: 100px;
    resize: vertical;
    padding: 8px 10px;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--apn-wa-inner-radius, 8px);
    font-size: 13px;
    color: #0f172a;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    background: #f8fafc;
    font-family: inherit;
    line-height: 1.4;
}

.coisa-wa-phone-wrap {
    display: flex;
    align-items: center;
    border: 1.5px solid #e2e8f0;
    border-radius: var(--apn-wa-inner-radius, 8px);
    overflow: hidden;
    background: #f8fafc;
    height: 42px;
}

.coisa-wa-flag-prefix {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 8px;
    background: #f1f5f9;
    border-right: 1.5px solid #e2e8f0;
    height: 42px;
    user-select: none;
}

.coisa-wa-code {
    font-size: 12.5px;
    font-weight: 700;
    color: #334155;
}

.coisa-wa-arrow {
    font-size: 8px;
    color: #64748b;
    margin-left: 2px;
}

.coisa-wa-phone-wrap input[type="tel"] {
    border: none !important;
    background: transparent !important;
    padding: 9px 10px !important;
    box-shadow: none !important;
    width: 100%;
    font-size: 13px;
}

.coisa-wa-terms {
    margin-bottom: 12px;
}

.coisa-wa-checkbox-container {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    font-size: 11px;
    color: #64748b;
    line-height: 1.35;
    cursor: pointer;
}

.coisa-wa-checkbox-container input {
    margin-top: 2px;
    cursor: pointer;
}

.coisa-wa-checkbox-container a {
    color: #0b685c;
    text-decoration: underline;
}

.coisa-wa-btn-submit {
    width: 100%;
    border: none;
    border-radius: var(--apn-wa-btn-radius, 8px);
    padding: 11px;
    min-height: 44px;
    color: #ffffff;
    font-weight: 800;
    font-size: 13.5px;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.coisa-wa-btn-submit:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.coisa-wa-btn-submit:active {
    transform: translateY(1px);
}

/* 3. Pie de Página Fijo (Footer) */
.coisa-wa-footer {
    flex-shrink: 0;
    background: #f8fafc;
    border-top: 1px solid #e2e8f0;
    padding: 6px 14px;
    border-bottom-left-radius: var(--apn-wa-radius, 20px);
    border-bottom-right-radius: var(--apn-wa-radius, 20px);
    display: flex;
    flex-direction: column;
    gap: 3px;
    text-align: center;
}

.coisa-wa-footer-status {
    font-size: 11px;
    font-weight: 700;
    color: #0b685c;
}

.apn-brand-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    font-size: 11.5px;
    opacity: .9;
    padding: 3px 6px;
    max-height: 40px;
}

.apn-footer-brand img,
.apn-brand-footer img,
.apn-footer-logo {
    width: 16px;
    height: 16px;
    object-fit: contain;
    display: inline-block;
    vertical-align: middle;
}

.apn-brand-footer a {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
    color: #475569;
    font-size: 11.5px;
    line-height: 1.2;
    transition: opacity 0.2s;
}

.apn-brand-footer a:hover {
    text-decoration: none;
    opacity: 1;
}

.apn-brand-footer a:hover strong {
    text-decoration: underline;
}

.apn-brand-footer span {
    font-size: 11.5px;
    color: #475569;
    line-height: 1.2;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.coisa-wa-footer-credits {
    font-size: 10.5px;
    color: #94a3b8;
}

/* Tablet Responsive (769px - 1024px) */
@media screen and (min-width: 769px) and (max-width: 1024px) {
    .coisa-wa-modal {
        width: 380px !important;
        max-width: 90vw !important;
    }
}

/* Mobile Responsive (@media max-width: 768px) */
@media screen and (max-width: 768px) {
    html body #coisa-wa-widget,
    html body div#coisa-wa-widget.coisa-wa-container {
        position: fixed !important;
        bottom: var(--apn-wa-offset-mobile, 90px) !important;
        z-index: 99999999 !important;
        width: auto !important;
        max-width: calc(100vw - 24px) !important;
        pointer-events: auto !important;
    }

    html body #coisa-wa-widget.apn-wa-modal-open,
    html body div#coisa-wa-widget.coisa-wa-container.apn-wa-modal-open {
        bottom: var(--apn-wa-offset-mobile, 16px) !important;
        left: 12px !important;
        right: 12px !important;
        width: calc(100vw - 24px) !important;
        max-width: calc(100vw - 24px) !important;
        margin: 0 auto !important;
        transform: none !important;
    }

    #coisa-wa-widget.apn-wa-modal-open #coisa-wa-bubble-wrap {
        display: none !important;
    }

    #coisa-wa-widget .coisa-wa-modal {
        position: relative !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        max-height: 90vh !important;
        border-radius: 16px !important;
        overflow: hidden !important;
        box-shadow: 0 16px 45px rgba(0, 0, 0, 0.28) !important;
        z-index: 100000000 !important;
        display: none;
        flex-direction: column !important;
    }

    .coisa-wa-header {
        flex-shrink: 0 !important;
        padding: 12px 14px !important;
        border-top-left-radius: 16px !important;
        border-top-right-radius: 16px !important;
    }

    .coisa-wa-body {
        flex: 1 1 auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        padding: 12px 14px !important;
        max-height: calc(90vh - 125px) !important;
    }

    .coisa-wa-instruction {
        font-size: 12px !important;
        line-height: 1.35 !important;
        margin-bottom: 10px !important;
    }

    .coisa-wa-field {
        margin-bottom: 8px !important;
    }

    .coisa-wa-field label {
        font-size: 11.5px !important;
        font-weight: 700 !important;
        margin-bottom: 3px !important;
        text-transform: none !important;
        letter-spacing: 0 !important;
    }

    .coisa-wa-field input[type="text"],
    .coisa-wa-field input[type="email"],
    .coisa-wa-field input[type="tel"] {
        height: 42px !important;
        min-height: 42px !important;
        padding: 8px 10px !important;
        font-size: 13px !important;
        border-radius: 8px !important;
        background: #f8fafc !important;
    }

    .coisa-wa-phone-wrap {
        height: 42px !important;
        min-height: 42px !important;
        border-radius: 8px !important;
    }

    .coisa-wa-flag-prefix {
        height: 42px !important;
        padding: 0 6px !important;
    }

    .coisa-wa-code {
        font-size: 12.5px !important;
    }

    .coisa-wa-textarea-compact {
        height: 44px !important;
        min-height: 44px !important;
        max-height: 80px !important;
        font-size: 13px !important;
        padding: 6px 10px !important;
        border-radius: 8px !important;
    }

    .coisa-wa-terms {
        margin-bottom: 10px !important;
    }

    .coisa-wa-checkbox-container {
        font-size: 11px !important;
        line-height: 1.3 !important;
        gap: 5px !important;
    }

    .coisa-wa-btn-submit {
        height: 44px !important;
        min-height: 44px !important;
        padding: 10px !important;
        font-size: 13.5px !important;
        font-weight: 800 !important;
        border-radius: 10px !important;
        margin-top: 2px !important;
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2) !important;
    }

    .coisa-wa-footer {
        flex-shrink: 0 !important;
        padding: 6px 12px !important;
        border-bottom-left-radius: 16px !important;
        border-bottom-right-radius: 16px !important;
    }

    .coisa-wa-footer-status {
        font-size: 10.5px !important;
    }

    .coisa-wa-footer-credits {
        font-size: 10px !important;
    }

    .coisa-wa-bubble {
        padding: 6px 12px 6px 6px;
        min-height: 48px;
        min-width: 48px;
    }

    .coisa-wa-bubble-label {
        font-size: 12.5px;
    }
}

