/**
 * WordPress Chat Buttons Plugin - Main Frontend Styles
 * Version: 2.0.0
 * 
 * This file contains styles for the frontend display of chat buttons.
 * It includes core styling from wp-chat-buttons-core.css and additional frontend-specific styles.
 * Animation effects are loaded separately via CSS Manager.
 */

/* Import core styles for shared components */
@import url('./wp-chat-buttons-core.css');

/* Button Container - Fixed Position */
.wp-chat-buttons-container {
    position: fixed !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 15px !important;
    z-index: 999999 !important;
    pointer-events: none !important;
}

.wp-chat-buttons-container > * {
    pointer-events: auto !important;
}

/* Ripple Container Styles - Needed for ripple effect */
.wp-chat-ripple-container {
    position: relative !important;
    display: inline-block !important;
}

/* Override any theme styles that might interfere */
.wp-chat-button-item:focus {
    outline: none !important;
}

.wp-chat-button-item:hover {
    text-decoration: none !important;
}

/* Button Styles - Additional frontend-specific styling */
.wp-chat-button-item {
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.2) !important;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1) !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.wp-chat-button-item:hover {
    transform: translateY(-3px) !important;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.25) !important;
}

/* Icon Styling */
.wp-chat-button-item img.wp-chat-button-icon {
    max-width: 60% !important;
    max-height: 60% !important;
    width: auto !important;
    height: auto !important;
    object-fit: contain !important;
}

.wp-chat-button-item .dashicons {
    color: white !important;
    font-size: 24px !important;
    width: 24px !important;
    height: 24px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Size-specific icon adjustments */
.wp-chat-buttons-size-small .wp-chat-button-item .dashicons {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

.wp-chat-buttons-size-large .wp-chat-button-item .dashicons {
    font-size: 28px !important;
    width: 28px !important;
    height: 28px !important;
}

/* 
 * Ripple Effect Base Styles
 * Note: These are basic default styles that will be overridden by
 * the animation-specific CSS files when they are loaded
 */
.wp-chat-button-ripple, 
.wp-chat-button-ripple-classic,
.ripple-active {
    position: relative !important;
    overflow: visible !important; /* Changed from hidden to visible to match animations/ripple.css */
}

/* Basic ripple animation structure (specific animation comes from animation CSS files) */
.wp-chat-button-ripple::before,
.wp-chat-button-ripple::after,
.wp-chat-button-ripple-classic::before,
.wp-chat-button-ripple-classic::after,
.wp-chat-buttons-ripple .wp-chat-button-item::before,
.wp-chat-buttons-ripple .wp-chat-button-item::after,
.wp-chat-buttons-container.wp-chat-buttons-ripple-classic .wp-chat-button-item::before,
.wp-chat-buttons-container.wp-chat-buttons-ripple-classic .wp-chat-button-item::after,
.ripple-active::before,
.ripple-active::after {
    content: '' !important;
    position: absolute !important;
    border-radius: 50% !important;
    pointer-events: none !important;
    z-index: -1 !important;
}

/* 
 * Note: Animation keyframes are defined in individual animation files.
 * We're not defining the rippleEffect keyframes here to avoid conflicts 
 * with the specific animation files (animations/ripple.css).
 * This ensures proper cascading of styles when the animation-specific CSS is loaded.
 */

/* Style Fixes for Mobile Devices */
@media (max-width: 767px) {
    .wp-chat-buttons-container {
        gap: 10px !important;
    }
    
    .wp-chat-buttons-right {
        right: 10px !important;
        bottom: 10px !important;
    }
    
    .wp-chat-buttons-left {
        left: 10px !important;
        bottom: 10px !important;
    }
    
    .wp-chat-buttons-size-large .wp-chat-button-item {
        width: 55px !important;
        height: 55px !important;
    }
    
    .wp-chat-buttons-style-rounded-with-text .wp-chat-button-item,
    .wp-chat-buttons-style-circle-with-text .wp-chat-button-item {
        padding-right: 15px !important;
        padding-left: 12px !important;
    }
    
    .wp-chat-button-text {
        font-size: 13px !important;
        margin-left: 8px !important;
    }
}

/* Button Size Variations - Override for frontend */
.wp-chat-buttons-size-small .wp-chat-button-item {
    width: 40px !important;
    height: 40px !important;
}

.wp-chat-buttons-size-medium .wp-chat-button-item {
    width: 50px !important;
    height: 50px !important;
}

.wp-chat-buttons-size-large .wp-chat-button-item {
    width: 60px !important;
    height: 60px !important;
}

/* Button Style with Text - Layout Adjustments */
.wp-chat-button-text {
    margin-left: 10px !important;
    color: white !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    line-height: 1.2 !important;
}

.wp-chat-buttons-style-rounded-with-text .wp-chat-button-item,
.wp-chat-buttons-style-circle-with-text .wp-chat-button-item {
    justify-content: flex-start !important;
    min-width: 40px !important;
    padding-left: 15px !important;
    padding-right: 20px !important;
}

/* Make sure container-level animations work correctly */
.wp-chat-buttons-container.wp-chat-buttons-animated .wp-chat-button-item,
.wp-chat-buttons-container.wp-chat-buttons-pulse .wp-chat-button-item,
.wp-chat-buttons-container.wp-chat-buttons-shake .wp-chat-button-item,
.wp-chat-buttons-container.wp-chat-buttons-ringing .wp-chat-button-item,
.wp-chat-buttons-container.wp-chat-buttons-phone-ring .wp-chat-button-item,
.wp-chat-buttons-container.wp-chat-buttons-ripple .wp-chat-button-item,
.wp-chat-buttons-container.wp-chat-buttons-ripple-classic .wp-chat-button-item {
    position: relative !important;
}

/* Admin preview styles - ensure consistency with frontend */
.wp-chat-buttons-preview-button,
.wp-chat-buttons-preview-buttons .ripple-active {
    position: relative !important;
}

/* 
 * Animation fallbacks - Minimal versions if specific animation files fail to load
 * These are applied with lower specificity so that they get overridden by specific animation files
 */
.wp-chat-button-pulse {
    animation: 1.5s ease-in-out infinite alternate;
    animation-name: simple-pulse;
}

@keyframes simple-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.1); }
}

/* 
 * Important note: This file provides basic styling for the wp-chat-buttons.
 * Individual animation styling is loaded separately through the CSS Manager 
 * based on which animations are actually used on the page.
 *
 * Animation-specific files are in the animations/ directory and include:
 * - ripple.css - Enhanced ripple effect
 * - ripple-classic.css - Classic ripple effect 
 * - pulse.css - Simple scaling pulse
 * - shake.css - Rotation-based shake effect
 * - ringing.css - Phone-like ringing animation
 * - phone-ring.css - Scaling phone ring animation
 */
