/**
 * Click to WhatsApp Chat - Frontend Styles
 *
 * @package Click_To_WhatsApp_Chat
 * @since 1.0.0
 */

/* Button Container */
#ctwc-whatsapp-button {
    position: fixed;
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 5px;
}

/* Position Classes */
#ctwc-whatsapp-button.ctwc-position-bottom-right {
    bottom: 20px;
    right: 20px;
}

#ctwc-whatsapp-button.ctwc-position-bottom-left {
    bottom: 20px;
    left: 20px;
}

#ctwc-whatsapp-button.ctwc-position-top-right {
    top: 20px;
    right: 20px;
}

#ctwc-whatsapp-button.ctwc-position-top-left {
    top: 20px;
    left: 20px;
}

/* Button Link */
.ctwc-button-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--ctwc-button-size, 60px);
    height: var(--ctwc-button-size, 60px);
    background-color: var(--ctwc-button-color, #25D366);
    border-radius: 50%;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    text-decoration: none;
    color: #ffffff;
}

.ctwc-button-link:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    background-color: var(--ctwc-button-hover-color, #128C7E);
    color: #ffffff;
}

.ctwc-button-link:focus {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
    background-color: var(--ctwc-button-hover-color, #128C7E);
}

/* WhatsApp Icon */
.ctwc-whatsapp-icon {
    width: var(--ctwc-icon-size, 30px);
    height: var(--ctwc-icon-size, 30px);
    fill: currentColor;
}

/* Dismiss Button */
.ctwc-dismiss-button {
    position: absolute;
    top: -8px;
    right: -8px;
    width: 22px;
    height: 22px;
    padding: 0;
    background-color: #ffffff;
    border: 1px solid #cccccc;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease;
}

.ctwc-dismiss-button:hover {
    background-color: #f5f5f5;
}

.ctwc-dismiss-button svg {
    width: 12px;
    height: 12px;
    fill: #666666;
}

/* Position adjustments for dismiss button */
#ctwc-whatsapp-button.ctwc-position-bottom-left .ctwc-dismiss-button,
#ctwc-whatsapp-button.ctwc-position-top-left .ctwc-dismiss-button {
    right: -8px;
    left: auto;
}

/* Shake Animation */
@keyframes ctwc-shake {
    0%, 100% {
        transform: translateX(0);
    }
    10%, 30%, 50%, 70%, 90% {
        transform: translateX(-5px);
    }
    20%, 40%, 60%, 80% {
        transform: translateX(5px);
    }
}

#ctwc-whatsapp-button.ctwc-animate .ctwc-button-link {
    animation: ctwc-shake 0.8s ease-in-out;
}

/* Hidden State */
#ctwc-whatsapp-button.ctwc-hidden {
    display: none;
}

/* Device Visibility */
@media screen and (min-width: 769px) {
    #ctwc-whatsapp-button.ctwc-hide-desktop {
        display: none !important;
    }
}

@media screen and (max-width: 768px) {
    #ctwc-whatsapp-button.ctwc-hide-mobile {
        display: none !important;
    }

    /* Adjust position for mobile */
    #ctwc-whatsapp-button.ctwc-position-bottom-right,
    #ctwc-whatsapp-button.ctwc-position-bottom-left {
        bottom: 15px;
    }

    #ctwc-whatsapp-button.ctwc-position-bottom-right {
        right: 15px;
    }

    #ctwc-whatsapp-button.ctwc-position-bottom-left {
        left: 15px;
    }

    #ctwc-whatsapp-button.ctwc-position-top-right,
    #ctwc-whatsapp-button.ctwc-position-top-left {
        top: 15px;
    }

    #ctwc-whatsapp-button.ctwc-position-top-right {
        right: 15px;
    }

    #ctwc-whatsapp-button.ctwc-position-top-left {
        left: 15px;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .ctwc-button-link {
        transition: none;
    }

    #ctwc-whatsapp-button.ctwc-animate .ctwc-button-link {
        animation: none;
    }
}

/* Print Styles */
@media print {
    #ctwc-whatsapp-button {
        display: none !important;
    }
}
