/**
 * TWG Mascot Greeting - Frontend Styles
 * 
 * @package TWG_Mascot_Greeting
 */

.twg-mascot-container {
    position: fixed;
    bottom: 30px;
    right: 0px;
    z-index: 999999;
    max-width: 320px;
    animation: twgSlideInFromRight 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    transition: transform 0.3s ease, opacity 0.3s ease;
    pointer-events: none;
}

.twg-mascot-container.allow-hover {
    pointer-events: auto;
}

.twg-mascot-container:hover {
    transform: translateY(-5px);
}

/* Transition states */
.twg-mascot-container.transitioning {
    opacity: 0.8;
}

.twg-mascot-container.transitioning .twg-mascot-animation {
    transform: scale(0.9);
}

/* Position variants */
.twg-mascot-container.position-bottom-left, 
.twg-mascot-container.position-top-left {
    animation: twgSlideInFromLeft 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    align-items: flex-start;
    left: 0;
    right: auto; 
}

.twg-mascot-container.position-top-right {
    top: 30px;
    bottom: auto;
}

.twg-mascot-container.position-top-left {
    top: 30px;
    bottom: auto;
}

/* Chat bubble styling */
.twg-mascot-message {
    font-size: 14px;
    font-weight: 500;
    color: #333;
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border-radius: 18px;
    padding: 12px 18px;
    box-shadow: 
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.05);
    margin-right: 30px;
    order: 1;
    line-height: 1.4;
    max-width: 320px;
    word-wrap: break-word;
    animation: twgFadeInUp 0.6s ease 0.8s both;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.twg-mascot-message > p:only-child {
    margin: 0;
}

/* Chat bubble tail */
.twg-mascot-message::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 20px;
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #ffffff;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
    transition: border-top-color 0.4s ease;
}

.twg-mascot-container.position-bottom-left .twg-mascot-message,
.twg-mascot-container.position-top-left .twg-mascot-message {
    margin-right: unset;
    margin-left: 30px;
}

.twg-mascot-container.position-bottom-left .twg-mascot-message::after,
.twg-mascot-container.position-top-left .twg-mascot-message::after {
    left: 20px;
    right: auto;
}

/* Lottie animation container */
.twg-mascot-animation {
    width: 157px;
    height: 157px;
    order: 2;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    transform-origin: center;
    margin-left: auto;
}

.twg-mascot-container.position-bottom-left .twg-mascot-animation,
.twg-mascot-container.position-top-left .twg-mascot-animation {
    margin-left: unset;
    margin-right: auto;
}


.twg-mascot-animation.scaling-out {
    transform: scale(0.8);
    opacity: 0.6;
}

.twg-mascot-container.position-bottom-left .twg-mascot-animation,
.twg-mascot-container.position-top-left .twg-mascot-animation {
    transform: rotateY(180deg);
}

.twg-mascot-container.position-bottom-left .twg-mascot-animation.scaling-out,
.twg-mascot-container.position-top-left .twg-mascot-animation.scaling-out {
    transform: rotateY(180deg) scale(0.8);
}

.twg-mascot-animation:hover {
    transform: scale(1.1);
}

.twg-mascot-container.position-bottom-left .twg-mascot-animation:hover,
.twg-mascot-container.position-top-left .twg-mascot-animation:hover {
    transform: rotateY(180deg) scale(1.1);
}

/* Close button */
.twg-mascot-close {
    position: absolute;
    top: -5px;
    right: 20px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #ff4757;
    color: white;
    border: none;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    z-index: 20;
    opacity: 0;
    transition: all 0.3s ease;
}

.twg-mascot-container.position-bottom-left .twg-mascot-close,
.twg-mascot-container.position-top-left .twg-mascot-close {
    left: 20px;
    right: auto;
}

.twg-mascot-container:hover .twg-mascot-close {
    opacity: 1;
    transform: scale(1.1);
}

/* Animations */
@keyframes twgSlideInFromRight {
    0% {
        transform: translateX(120%) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

@keyframes twgSlideInFromLeft {
    0% {
        transform: translateX(-120%) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateX(0) translateY(0);
        opacity: 1;
    }
}

@keyframes twgFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }
    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes twgBounceIn {
    0% {
        opacity: 0;
        transform: scale(0.3);
    }
    50% {
        transform: scale(1.05);
    }
    70% {
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* Reminder pulse animation */
@keyframes twgReminderPulse {
    0%, 100% {
        box-shadow: 
            0 4px 12px rgba(0, 0, 0, 0.08),
            0 2px 4px rgba(0, 0, 0, 0.05);
        transform: translateY(0);
    }
    50% {
        box-shadow: 
            0 6px 16px rgba(240, 173, 78, 0.15),
            0 4px 8px rgba(240, 173, 78, 0.1);
        transform: translateY(-2px);
    }
}

/* Responsive design */
@media (max-width: 768px) {
    .twg-mascot-container {
        bottom: 20px;
        max-width: 280px;
    }
    
    .twg-mascot-container.position-top-right {
        top: 20px;
    }
    
    .twg-mascot-container.position-top-left {
        top: 20px;
    }
    
    .twg-mascot-message {
        font-size: 14px;
        max-width: 280px;
    }

    .twg-mascot-close {
        opacity: 1;
        animation: twgBounceIn 0.6s ease 1s both;
    }

    .twg-mascot-container.transitioning .twg-mascot-close {
        transition: 0 !important;
        opacity: 0 !important;
    }

    .twg-mascot-container.reminder-mode .twg-mascot-close {
        animation: twgBounceIn 0.6s ease 3s both !important;
    }
}

/* Hidden state */
.twg-mascot-container.hidden {
    display: none;
}
