/**
 * WooCommerce Avatar Virtual - Floating Mascot Styles
 */

/* Floating Mascot Container */
.wav-floating-mascot {
    position: fixed !important;
    bottom: 20px !important;
    right: 20px !important;
    z-index: 999999 !important;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    pointer-events: none;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Speech Bubble */
.wav-speech-bubble {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 12px 18px;
    margin-bottom: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    max-width: 200px;
    min-width: 150px;
    pointer-events: auto;
    animation: bubbleFloat 3s ease-in-out infinite;
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.wav-speech-bubble.show {
    opacity: 1;
    transform: translateY(0);
}

.wav-bubble-content {
    position: relative;
    z-index: 2;
}

.wav-bubble-text {
    font-size: 14px;
    color: #333;
    line-height: 1.4;
    display: block;
    font-weight: 500;
}

.wav-bubble-tail {
    position: absolute;
    bottom: -8px;
    right: 30px;
    width: 0;
    height: 0;
    border-left: 10px solid transparent;
    border-right: 10px solid transparent;
    border-top: 10px solid #fff;
}

@keyframes bubbleFloat {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-5px);
    }
}

/* Mascot Character */
.wav-mascot-wrapper {
    position: relative;
    width: 120px;
    height: 180px;
    pointer-events: none;
}

.wav-mascot-character {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.1));
    transition: transform 0.3s ease;
    animation: mascotIdle 2s ease-in-out infinite;
}

.wav-floating-mascot.recording .wav-mascot-character {
    animation: mascotListening 0.8s ease-in-out infinite;
}

.wav-floating-mascot.speaking .wav-mascot-character {
    animation: mascotSpeaking 0.5s ease-in-out infinite;
}

@keyframes mascotIdle {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-3px) scale(1.02);
    }
}

@keyframes mascotListening {
    0%, 100% {
        transform: translateY(0) scale(1);
    }
    50% {
        transform: translateY(-5px) scale(1.05);
    }
}

@keyframes mascotSpeaking {
    0%, 100% {
        transform: translateY(0);
    }
    25% {
        transform: translateY(-2px) scale(1.02);
    }
    75% {
        transform: translateY(-2px) scale(1.02);
    }
}

/* Avatar Mouth Animation */
.wav-avatar-mouth {
    position: absolute;
    bottom: 35%;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 15px;
    background: #fff;
    border-radius: 0 0 30px 30px;
    transition: all 0.1s ease;
    opacity: 0;
    pointer-events: none;
}

.wav-floating-mascot.speaking .wav-avatar-mouth {
    opacity: 1;
}

.wav-avatar-mouth[data-state="closed"] {
    height: 4px;
    border-radius: 4px;
}

.wav-avatar-mouth[data-state="half-open"] {
    height: 12px;
    border-radius: 0 0 20px 20px;
}

.wav-avatar-mouth[data-state="open"] {
    height: 20px;
    border-radius: 0 0 25px 25px;
}

/* Microphone Button (Discrete) */
.wav-mic-button-discrete {
    margin-top: 8px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(102, 126, 234, 0.9);
    border: 2px solid #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    pointer-events: auto;
    color: #fff;
    padding: 0;
}

.wav-mic-button-discrete:hover {
    background: rgba(102, 126, 234, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.wav-mic-button-discrete:active {
    transform: scale(0.95);
}

.wav-mic-button-discrete.recording {
    background: #ff6b6b;
    animation: micPulse 1s ease-in-out infinite;
}

@keyframes micPulse {
    0%, 100% {
        box-shadow: 0 2px 10px rgba(255, 107, 107, 0.4);
    }
    50% {
        box-shadow: 0 2px 20px rgba(255, 107, 107, 0.8);
    }
}

.wav-mic-icon-small {
    width: 20px;
    height: 20px;
}

/* Avatar Switcher (Hidden by default, shown on hover) */
.wav-avatar-switcher {
    position: absolute;
    top: -40px;
    right: 0;
    display: flex;
    gap: 5px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.wav-floating-mascot:hover .wav-avatar-switcher {
    opacity: 1;
    pointer-events: auto;
}

.wav-switch-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: rgba(255, 255, 255, 0.9);
    cursor: pointer;
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    padding: 0;
}

.wav-switch-avatar:hover {
    background: #fff;
    transform: scale(1.1);
}

/* Products Overlay/Modal */
.wav-products-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    backdrop-filter: blur(4px);
}

.wav-products-modal {
    background: #fff;
    border-radius: 20px;
    max-width: 900px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    position: relative;
    padding: 30px;
}

.wav-close-products {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 35px;
    height: 35px;
    border-radius: 50%;
    border: none;
    background: #f5f5f5;
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    padding: 0;
}

.wav-close-products:hover {
    background: #e0e0e0;
    transform: rotate(90deg);
}

.wav-products-title {
    font-size: 24px;
    font-weight: 600;
    margin: 0 0 20px 0;
    color: #333;
    padding-right: 40px;
}

.wav-products-list {
    min-height: 100px;
}

.wav-empty-state {
    text-align: center;
    color: #999;
    font-size: 14px;
    padding: 40px 20px;
    margin: 0;
}

/* Products Grid */
.wav-products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.wav-product-item {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    overflow: hidden;
    transition: all 0.3s ease;
    cursor: pointer;
}

.wav-product-item:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    border-color: #667eea;
}

.wav-product-image {
    width: 100%;
    height: 180px;
    overflow: hidden;
    background: #f5f5f5;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wav-product-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wav-product-info {
    padding: 15px;
}

.wav-product-title {
    font-size: 14px;
    font-weight: 600;
    margin: 0 0 8px 0;
    color: #333;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.wav-product-price {
    font-size: 18px;
    font-weight: 700;
    color: #667eea;
    margin-bottom: 10px;
}

.wav-product-link {
    display: inline-block;
    padding: 8px 15px;
    background: #667eea;
    color: #fff;
    text-decoration: none;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    transition: background 0.3s ease;
    width: 100%;
    text-align: center;
    box-sizing: border-box;
}

.wav-product-link:hover {
    background: #5568d3;
    color: #fff;
}

/* Responsive */
@media (max-width: 768px) {
    .wav-floating-mascot {
        bottom: 15px;
        right: 15px;
    }

    .wav-mascot-wrapper {
        width: 100px;
        height: 150px;
    }

    .wav-speech-bubble {
        max-width: 180px;
        min-width: 120px;
        padding: 10px 15px;
    }

    .wav-bubble-text {
        font-size: 12px;
    }

    .wav-mic-button-discrete {
        width: 36px;
        height: 36px;
    }

    .wav-mic-icon-small {
        width: 18px;
        height: 18px;
    }

    .wav-products-modal {
        padding: 20px;
        max-height: 90vh;
    }

    .wav-products-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 15px;
    }

    .wav-product-image {
        height: 150px;
    }
}

@media (max-width: 480px) {
    .wav-floating-mascot {
        bottom: 10px;
        right: 10px;
    }

    .wav-mascot-wrapper {
        width: 80px;
        height: 120px;
    }

    .wav-speech-bubble {
        max-width: 150px;
        min-width: 100px;
        padding: 8px 12px;
        font-size: 11px;
    }

    .wav-products-grid {
        grid-template-columns: 1fr;
    }
}

/* Accessibility */
.wav-mic-button-discrete:focus,
.wav-switch-avatar:focus,
.wav-close-products:focus {
    outline: 3px solid rgba(102, 126, 234, 0.5);
    outline-offset: 2px;
}

/* Hide on print */
@media print {
    .wav-floating-mascot,
    .wav-products-overlay {
        display: none !important;
    }
}
