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

.twg-mascot-container {
    position: fixed;
    bottom: 30px;
    right: 0px;
    z-index: 999999;
    max-width: 325px;
    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;
    color: #1D1D1DCC;
}

.twg-mascot-container img {
    display: block;
}

.twg-mascot-container.hidden {
    display: 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 {
    animation: twgSlideInFromLeft 1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    align-items: flex-start;
    left: 0;
    right: auto;
}

/* Chat bubble styling */
.twg-mascot-message-container {
    display: flex;
    flex-direction: row;
    background: #ffffff;
    border-radius: 10px;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.05);
    margin-right: 30px;
    max-width: 325px;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    pointer-events: none;
    padding: 14px 16px 14px 11px;
    opacity: 0;
}

.twg-mascot-message-close {
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    margin-right: 8px;
}

.twg-mascot-message-close.closing {
    display: none !important;
}

.twg-mascot-container.position-bottom-left .twg-mascot-message-container .twg-mascot-message-close {
    order: 2;
    transform: rotateY(180deg);
    margin-right: unset;
    margin-left: 8px;
}

.twg-mascot-message-close button {
    padding: 0;
    border: none;
    background-color: transparent;
    width: 20px;
    height: 20px;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.twg-mascot-message-close button:hover {
    background-color: #c7dd0358;
}

.twg-mascot-message,
.twg-mascot-help-text {
    font-size: 14px;
    line-height: 1.4;
    font-weight: 500;
    color: #1D1D1DCC;
    word-wrap: break-word;
}

.twg-mascot-help-text {
    display: none;
}

.twg-mascot-message-container.show-help-text .twg-mascot-help-text {
    display: block !important;
}

.twg-mascot-message-container.show-help-text .twg-mascot-message {
    display: none !important;
}

.twg-mascot-message-container.twg-message-fade-in-up {
    animation: twgFadeInUp 0.6s ease 5s both;
    pointer-events: auto;
}

.twg-mascot-message-container.closing {
    animation: twgFadeOutRight 0.6s ease both !important;
    pointer-events: none !important;
}

.twg-mascot-container.position-bottom-left .twg-mascot-message-container.closing {
    animation: twgFadeOutLeft 0.6s ease both !important;
    pointer-events: none !important;
}

.twg-mascot-message-container.show-help-text {
    animation: twgFadeInUp 0.6s ease 0s both !important;
    padding: 14px 16px 14px 16px;
}

.twg-mascot-message-container.closing-important {
    display: none !important;
}

.twg-mascot-message-container.show-help-text .twg-mascot-message-close {
    display: none;
}

.twg-mascot-container.position-bottom-left .twg-mascot-message-container {
    padding: 14px 11px 14px 16px;
}

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

/* Chat bubble tail */
.twg-mascot-message-container::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 40px;
    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-container {
    margin-right: unset;
    margin-left: 30px;
}

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

.twg-mascot-wrapper {
    position: relative;
}

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

.twg-mascot-container.position-bottom-left .twg-mascot-animation {
    margin-left: unset;
    margin-right: auto;
    padding-right: unset;
    padding-left: 5px;
}


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

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

.twg-mascot-container.position-bottom-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 {
    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;

    /* Disable: 07/08/2025 */
    display: none !important;
}

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

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

/* Responsive design */
@media (max-width: 768px) {
    .twg-mascot-container {
        bottom: 20px;
        max-width: 280px;
    }

    .twg-mascot-message-container {
        font-size: 14px;
        max-width: 280px;
        margin-right: 20px;
    }

    .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;
    }

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

    .twg-mascot-animation {
        width: 100px;
        height: 100px;
    }

    .twg-mascot-message-container::after {
        right: 28px;
    }

    .twg-mascot-container.position-bottom-left .twg-mascot-message-container::after {
        left: 28px;
    }
}


/* Chat box */
.twg-chat-container {
    pointer-events: none;
    transition: all 0.3s ease;
    transform: translateY(30px);
    opacity: 0;
    position: absolute;
    z-index: 999999;
    top: -494px;
    bottom: auto;
    right: 30px;
}

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

.twg-chat-container.active {
    pointer-events: all;
    transform: translateY(0);
    opacity: 1;
}

.twg-chat-header {
    padding: 12px 22px;
    background: rgba(201, 221, 3, 1);
    color: rgba(0, 35, 149, 1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: bold;
    border-radius: 10px 10px 0 0;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.05);
}

.twg-chat-header button {
    background: transparent;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0;
}

.twg-chat-box {
    width: 325px;
    height: 450px;
    z-index: 1000;
    background-color: #fff;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.05);
    border-radius: 0 0 10px 10px;
    overflow: hidden;
}

.twg-chat-container::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 40px;
    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));
}

.twg-mascot-container.position-bottom-left .twg-chat-container::after {
    left: 40px;
    right: auto;
}

.twg-chat-box iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* Social */
.twg-social-container {
    position: absolute;
    z-index: 999999;
    top: 50%;
    transform: translateY(-50%);
    right: 150px;
    display: flex;
    align-items: center;
    pointer-events: none;
    margin-top: 15px;
}

.twg-mascot-container.position-bottom-left .twg-social-container {
    right: auto;
    left: 150px;
    transform: rotateY(180deg);
}

.twg-social-container.active {
    pointer-events: all;
}

.twg-social-links {
    display: grid;
    grid-template-columns: auto auto auto auto;
    justify-content: center;
    align-items: center;
    column-gap: 12px;
}

.twg-social-link {
    display: inline-flex;
    width: 40px;
    height: 40px;
    overflow: hidden;
    border-radius: 10px;
    align-items: center;
    justify-content: center;
    background-color: #ffffff;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
    border-radius: 50%;
}

.twg-social-link:hover {
    background-color: #c7dd0358;
}

.twg-social-container.active .twg-social-links .twg-social-link {
    animation: twgFadeInLeft 0.6s ease both;
}

.twg-social-container.active .twg-social-links .twg-social-link:nth-child(1) {
    animation-delay: 0.1s;
}

.twg-social-container.active .twg-social-links .twg-social-link:nth-child(2) {
    animation-delay: 0.2s;
}

.twg-social-container.active .twg-social-links .twg-social-link:nth-child(3) {
    animation-delay: 0.3s;
}

.twg-social-container.active .twg-social-links .twg-social-link:nth-child(4) {
    animation-delay: 0.4s;
}

.twg-social-container.closing .twg-social-links .twg-social-link {
    animation: twgFadeOutRight 0.4s ease both;
}

.twg-social-container.closing .twg-social-links .twg-social-link:nth-child(4) {
    animation-delay: 0.1s;
}

.twg-social-container.closing .twg-social-links .twg-social-link:nth-child(3) {
    animation-delay: 0.2s;
}

.twg-social-container.closing .twg-social-links .twg-social-link:nth-child(2) {
    animation-delay: 0.3s;
}

.twg-social-container.closing .twg-social-links .twg-social-link:nth-child(1) {
    animation-delay: 0.4s;
}

.twg-social-link img {
    width: 24px;
    height: 24px;
}

.twg-social-container.active button.twg-social-close {
    animation: twgFadeInLeft 0.6s ease 0.5s both;
}

.twg-social-container.closing button.twg-social-close {
    animation: twgFadeOutRight 0.6s ease 0.5s both;
}

button.twg-social-close {
    padding: 0;
    border: 1px solid #26439533;
    background-color: #ffffff;
    box-shadow:
        0 4px 12px rgba(0, 0, 0, 0.08),
        0 2px 4px rgba(0, 0, 0, 0.05);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 10px;
    cursor: pointer;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    opacity: 0;
}

button.twg-social-close:hover {
    background-color: #c7dd0358;
}

@media (max-width: 768px) {
    .twg-social-container {
        right: 120px;
    }

    .twg-mascot-container.position-bottom-left .twg-social-container {
        right: auto;
        left: 120px;
    }

    .twg-chat-container {
        right: 20px;
    }

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

    .twg-chat-container::after {
        right: 28px;
    }

    .twg-mascot-container.position-bottom-left .twg-chat-container::after {
        left: 28px;
    }
}


/* 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 twgFadeInUp {
    0% {
        opacity: 0;
        transform: translateY(20px);
    }

    100% {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes twgFadeInLeft {
    0% {
        opacity: 0;
        transform: translateX(20px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}


@keyframes twgFadeOutLeft {
    0% {
        opacity: 1;
        transform: translateX(0px);
    }

    100% {
        opacity: 0;
        transform: translateX(-20px);
    }
}

@keyframes twgFadeOutRight {
    0% {
        opacity: 1;
        transform: translateX(0);
    }

    100% {
        opacity: 0;
        transform: translateX(20px);
    }
}

@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);
    }
}
