/* WhatsApp Sticky Button - Performance Optimized */
/* Reset */
*, *:after, *:before { margin: 0; padding: 0; box-sizing: border-box; }

/* Variables */
:root {
    --whatsapp: #21c063;
    --whatsapp-900: #0c6156;
    --white: #fff;
    --black: #000;
}

.hidden { display: none; }

/* Prevent flash on page load - hide until JavaScript loads */
#wpp-fix {
    opacity: 0;
}

#wpp-fix.loaded {
    opacity: 1;
    transition: opacity 0.3s ease-in;
}

/* Animations */
@keyframes wiggle {
    0% { transform: rotate(-3deg); }
    20% { transform: rotate(20deg); }
    40% { transform: rotate(-15deg); }
    60% { transform: rotate(5deg); }
    90% { transform: rotate(-1deg); }
    100% { transform: rotate(0); }
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.6); }
    100% { transform: scale(1.7); opacity: 0; }
}

#wpp-fix {
    position: fixed;
    bottom: 20px;
    right: 20px;
    z-index: 9998;
}

#wpp-fix .wpp-link {
    background: var(--whatsapp);
    display: flex;
    z-index: 2;
    position: relative;
    padding: 15px;
    border: none;
    cursor: pointer;
    border-radius: 50%;
    box-shadow: 0px 3px 10px rgba(33, 192, 99, 0.56);
    transform: scale(1);
    transition: none; /* Disable transition on page load */
}

/* Enable transitions only after page load */
#wpp-fix.loaded .wpp-link {
    transition: all 0.3s ease-in-out;
}

#wpp-fix .wpp-link > span { display: none; }

#wpp-fix .wpp-link:hover {
    transform: scale(1.05);
    background: #19a554;
}

#wpp-fix .wpp-link.hide-this {
    opacity: 0;
    visibility: hidden;
    transform: scale(0.5);
}

#wpp-fix .wpp-link.hide-this + .form-wpp {
    visibility: visible;
    opacity: 1;
    transform: scale(1);
    border-radius: 3px;
}

#wpp-fix .wpp-link.hide-this + .form-wpp + .mask {
    opacity: 1;
    visibility: visible;
}

#wpp-fix .form-wpp {
    position: absolute;
    box-shadow: 0 0 20px 0 rgba(0, 0, 0, 0.12);
    border-radius: 50%;
    bottom: 0;
    right: 0px;
    opacity: 0;
    overflow: hidden;
    transform: scale(0.2);
    z-index: 1;
    visibility: hidden;
    transform-origin: bottom right;
    width: 100%;
    max-width: 300px;
    min-width: 350px;
    transition: none; /* Disable transition on page load */
}

/* Enable transitions only after page load */
#wpp-fix.loaded .form-wpp {
    transition: all 0.3s ease-in-out;
}

#wpp-fix .form-wpp + .mask {
    position: fixed;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    background: rgba(0, 0, 0, 0.8);
    opacity: 0;
    visibility: hidden;
    transition: none; /* Disable transition on page load */
}

/* Enable transitions only after page load */
#wpp-fix.loaded .form-wpp + .mask {
    transition: all 0.3s ease-in-out;
}

#wpp-fix .form-content {
    padding: 15px;
    float: left;
    position: relative;
    width: 100%;
    background-color: #e9e0d7;
    background-position: 50%;
    background-size: cover;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><rect fill="%23e9e0d7" width="100" height="100"/></svg>');
    transition: none; /* Disable transition on page load */
}

/* Enable transitions only after page load */
#wpp-fix.loaded .form-content {
    transition: all 0.3s ease-in-out;
}

#wpp-fix .buss-msg {
    background-color: var(--white);
    padding: 10px;
    border-radius: 0 4px 4px 4px;
    line-height: 1.3;
    font-size: 15px;
    max-width: 270px;
    margin: 0 0 10px;
    position: relative;
}

#wpp-fix .buss-msg::before {
    content: '';
    position: absolute;
    border-top: 5px solid var(--white);
    border-right: 5px solid var(--white);
    border-bottom: 5px solid transparent;
    border-left: 5px solid transparent;
    left: -10px;
    top: 0;
}

#wpp-fix form {
    width: calc(300px - 30px);
    transition: all 0.3s ease-in-out;
    float: right;
    position: initial;
}

#wpp-fix form label {
    line-height: 1;
    margin-bottom: 0px;
}

#wpp-fix form label.error {
    font-size: 10px;
    padding: 0 5px;
    position: absolute;
    right: 0;
    bottom: 3px;
}

#wpp-fix form .campo {
    position: relative;
    float: left;
    width: 100%;
    margin-bottom: 5px;
}

#wpp-fix form .form-control-wrap {
    float: left;
    width: 100%;
    position: relative;
}

#wpp-fix form .form-control-wrap::after {
    content: '';
    position: absolute;
    border-top: 5px solid #e7ffe7;
    border-right: 5px solid transparent;
    border-bottom: 5px solid transparent;
    border-left: 5px solid #e7ffe7;
    right: -10px;
    top: 0;
}

#wpp-fix form input[type="text"],
#wpp-fix form input[type="tel"],
#wpp-fix form input[type="email"],
#wpp-fix form select {
    border-radius: 4px 0 4px 4px;
    width: 100%;
    padding: 10px;
    background: #e7ffe7;
    border: 1px solid #e7ffe7;
    font-size: 1rem;
    font-family: inherit;
}

#wpp-fix form select {
    cursor: pointer;
    appearance: none;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12"><path fill="%23333" d="M6 9L1 4h10z"/></svg>');
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}

#wpp-fix form input.error,
#wpp-fix form input.not-valid,
#wpp-fix form select.error {
    border-color: #F44336;
}

#wpp-fix form .btn {
    float: right;
    margin-top: 5px;
}

#wpp-fix form .btn button {
    transition: all 0.3s ease-in-out;
    background-color: var(--whatsapp-900);
    border: 1px solid var(--whatsapp-900);
    text-transform: initial;
    cursor: pointer;
    padding: 8px 12px;
    color: var(--white);
    border-radius: 4px;
    font-size: 1rem;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

#wpp-fix form .btn button:hover {
    border-color: #084f45;
    background-color: #084f45;
    box-shadow: 0 1px 4px 0 rgba(12, 97, 86, 0.52);
}

#wpp-fix form .response-output {
    font-size: 0.9rem;
    line-height: 1.2;
    float: left;
    margin: 0;
    width: 100%;
    display: none;
    opacity: 0;
}

#wpp-fix form::after {
    transition: all 0.3s ease-in-out;
    content: '';
    position: absolute;
    width: calc(100% + 4px);
    height: calc(100% + 15px);
    background: rgba(255, 255, 255, 0.93);
    left: -2px;
    top: -9px;
    z-index: 5;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="40" height="40" viewBox="0 0 50 50"><circle cx="25" cy="25" r="20" fill="none" stroke="%2321c063" stroke-width="4"><animate attributeName="stroke-dasharray" dur="1.5s" values="1,150;90,150;90,150" repeatCount="indefinite"/><animate attributeName="stroke-dashoffset" dur="1.5s" values="0;-35;-124" repeatCount="indefinite"/></circle></svg>');
    background-size: 70px;
    background-repeat: no-repeat;
    background-position: 50%;
    opacity: 0;
    visibility: hidden;
}

#wpp-fix form.submitting::after {
    opacity: 1;
    visibility: visible;
}

#wpp-fix form.sent {
    height: 50px;
}

#wpp-fix form.sent .response-output {
    position: absolute;
    width: 100%;
    height: calc(100% + 15px);
    background: var(--white);
    opacity: 1;
    left: 0;
    font-size: 1.4rem;
    text-align: center;
    top: 0;
    align-items: center;
    display: flex;
    justify-content: center;
}

#wpp-fix .head-wpp {
    width: 100%;
    padding: 12px 8px;
    background: var(--whatsapp-900);
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    z-index: 6;
}

#wpp-fix .head-wpp img {
    margin-right: 8px;
    width: 50px;
    border-radius: 50%;
}

#wpp-fix .head-wpp h3 {
    word-break: keep-all;
    padding-right: 30px;
    font-size: 1.1rem;
    font-weight: 500;
    color: var(--white);
    margin: 0 0 0 10px;
}

#wpp-fix .close {
    color: var(--white);
    position: absolute;
    cursor: pointer;
    right: 0;
    top: 0;
    padding: 7px 8px;
    font-size: 1.375rem;
    line-height: 1;
}

#wpp-fix svg {
    width: initial;
    display: block;
    height: 30px;
}

#wpp-fix svg path {
    fill: var(--white);
}

#wpp-fix.shake .wpp-link::before {
    transition: all 0.3s ease-in-out;
    background: rgba(33, 192, 99, 0.6);
    content: '';
    width: 100%;
    height: 100%;
    position: absolute;
    border-radius: 50%;
    z-index: -1;
    top: 0px;
    right: 0;
    animation: pulse 2s infinite;
}

#wpp-fix.shake svg {
    animation: wiggle 1s ease infinite;
}

/* Mobile Responsiveness */
@media (max-width: 767px) {
    #wpp-fix {
        bottom: 15px;
    }
    
    #wpp-fix svg {
        height: 30px;
    }
    
    #wpp-fix .wpp-link {
        padding: 10px;
    }
    
    #wpp-fix .form-wpp form {
        width: calc(300px - 40px);
    }
    
    #wpp-fix form input[type="text"],
    #wpp-fix form input[type="email"],
    #wpp-fix form input[type="tel"],
    #wpp-fix form select {
        font-size: 0.875rem;
    }
    
    #wpp-fix form .btn button {
        font-size: 0.875rem;
    }
}

@media (max-width: 395px) {
    #wpp-fix .form-wpp {
        min-width: 290px;
    }
    
    #wpp-fix .head-wpp img {
        width: 40px;
    }
}
