/* Main container styles */
.replypilot-chat-popup {
    position: fixed;
    bottom: 75px;
    right: 90px;
    background: linear-gradient(135deg, #4f9fea, #2c9866) border-box;
    color: #fff;
    padding: 18px 30px 18px 18px;
    border-radius: 20px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    font-size: 15px;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.5s ease;
    z-index: 1000;
    --r: 10px;
    --t: 1.5em;
    --_p: 100%;
    border-radius: calc(var(--r) + var(--t)) / var(--r);
    border-inline: var(--t) solid #0000;
    mask: radial-gradient(100% 100% at var(--_p) 0, #0000 99%, #000 102%) var(--_p) 100% / var(--t) var(--t) no-repeat, linear-gradient(#000 0 0) padding-box;
    border-bottom-right-radius: 0 0;
    place-self: end;
    animation: bounce-right 0.8s both;
}

.replypilot-chat-popup>span {
    padding: 6px 10px 20px 10px;
    position: absolute;
    top: 0;
    right: 0;
    font-weight: 900;
    font-family: 'Nunito';
    cursor: pointer;
    transition: all .8s
}

.replypilot-chat-popup>span:hover {
    transform: scale(1.3);
}

@keyframes bounce-right {
    0% {
        transform: translateX(48px);
        animation-timing-function: ease-in;
        opacity: 1;
    }
    24% {
        opacity: 1;
    }
    40% {
        transform: translateX(26px);
        animation-timing-function: ease-in;
    }
    65% {
        transform: translateX(13px);
        animation-timing-function: ease-in;
    }
    82% {
        transform: translateX(6.5px);
        animation-timing-function: ease-in;
    }
    93% {
        transform: translateX(4px);
        animation-timing-function: ease-in;
    }
    25%,
    55%,
    75%,
    87%,
    98% {
        transform: translateX(0px);
        animation-timing-function: ease-out;
    }
    100% {
        transform: translateX(0px);
        animation-timing-function: ease-out;
        opacity: 1;
    }
}

.replypilot-chat-popup.show {
    opacity: 1;
    transform: translateY(0);
}
.replypilot-chat-popup.hidden {
    display: none;
}
#replypilot-chatbot-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 380px;
    max-height: 70vh;
    min-height: min(max(390px, 70vh), 550px);
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    z-index: 9999;
    font-family: -apple-system, BlinkMacSystemFont, \'Segoe UI\', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    transition: all 0.3s ease;
    overflow: hidden;
    transform: translateY(20px);
    opacity: 0;
    visibility: hidden;
}
#replypilot-chatbot-container:not(.closed) {
    transform: translateY(0);
    opacity: 1;
    visibility: visible;
}
/* Header styles */
#replypilot-chatbot-header {
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    padding: 10px;
    display: flex;
    align-items: center;
    position: relative;
}
#replypilot-chatbot-avatar {
    width: 32px;
    height: 32px;
    background: white;
    border-radius: 50%;
    margin-right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #4285f4;
    font-weight: bold;
}
#replypilot-chatbot-avatar img {
    width: 30px;
    height: auto;
}
#replypilot-chatbot-header span {
    flex: 1;
    font-weight: 500;
    font-size: 16px;
}
.replypilot-clearchat-dialogbox {
    position: absolute;
    z-index: 1;
    background: #fff;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0px 0px 15px 0px #7e7e7e;
    padding: 10px;
    width: 80%;
    border-radius: 5px;
    display: none;
}
.replypilot-clearchat-dialogbox p {
    margin-bottom: 20px;
}
#replypilot-cancel-chat,
#replypilot-confirm-chat {
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 5px;
    margin: 0 5px;
    font-size: 14px;
    color: #ffff;
    background: #939395;
}
#replypilot-cancel-chat:hover {
    background: #b3b3b5;
}
#replypilot-confirm-chat {
    background: #ba1025;
}
#replypilot-confirm-chat:hover {
    background: #e03c4d;
}
.replypilot-dialogbox-btn {
    display: flex;
    justify-content: flex-end;

}
#replypilot-chatbot-close,
#replypilot-chatbot-minimize {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    opacity: 0.8;
    transition: opacity 0.2s;
    font-size: 36px;
    padding: 0px 7px;
    letter-spacing: -4px;
}
#replypilot-chatbot-minimize:hover,
#replypilot-chatbot-close:hover {
    opacity: 1;
}
/* Messages area */
#replypilot-chatbot-messages {
    flex: 1;
    padding: 15px;
    overflow-y: auto;
    background: #f9f9f9;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: all .3s;
}
.replypilot-message {
    max-width: 80%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    animation: fadeIn 0.3s ease;
}
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}
.replypilot-user-message {
    background: #4285f4;
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 4px;
    font-size: 16px;
}
.replypilot-bot-message {
    background: #ffffff;
    color: #333;
    align-self: flex-start;
    border-bottom-left-radius: 4px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    font-size: 16px;
}
.replypilot-welcome {
    background: #e8f0fe;
    color: #1967d2;
}
.replypilot-message-content {
    word-wrap: break-word;
    line-height: 1.4;
}
.replypilot-message-time {
    font-size: 11px;
    opacity: 0.7;
    margin-top: 4px;
    text-align: right;
}
.replypilot-user-message .replypilot-message-time {
    color: rgba(255, 255, 255, 0.7);
}
/* Typing indicator */
.replypilot-typing .replypilot-message-content {
    display: flex;
    align-items: center;
    height: 20px;
}
.replypilot-message-content a {
    text-decoration: none;
    color: #4285f4;
}
.replypilot-typing-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ccc;
    margin: 0 2px;
    animation: typingAnimation 1.4s infinite ease-in-out;
}
.replypilot-typing-dot:nth-child(1) {
    animation-delay: 0s;
}
.replypilot-typing-dot:nth-child(2) {
    animation-delay: 0.2s;
}
.replypilot-typing-dot:nth-child(3) {
    animation-delay: 0.4s;
}
@keyframes typingAnimation {
    0%,
    60%,
    100% {
        transform: translateY(0);
    }
    30% {
        transform: translateY(-5px);
    }
}
/* Input area */
#replypilot-chatbot-input {
    display: flex;
    padding: 12px;
    border-top: 1px solid #eee;
    background: white;
    align-items: flex-end;
    font-size: 16px;
}
#replypilot-chatbot-user-input {
    flex: 1;
    padding: 7px 14px;
    border: 1px solid #ddd;
    border-radius: 20px;
    resize: none;
    max-height: 60px;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    transition: border 0.2s;
    height: 40px;
}
#replypilot-chatbot-user-input:focus {
    border-color: #4285f4;
}
#replypilot-chatbot-send {
    background: #4285f4;
    color: white;
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    margin-left: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    font-size: 40px;
    font-family: arial, sans-serif;
    font-weight: 500;
    padding: 0;
}
#replypilot-chatbot-send:hover {
    background: #3367d6;
}
#replypilot-chatbot-send svg {
    width: 20px;
    height: 20px;
}
/* Toggle button */
#replypilot-chatbot-toggle {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background: linear-gradient(135deg, #4285f4, #34a853);
    color: white;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    z-index: 9998;
    transition: all 0.3s ease;
}
#replypilot-chatbot-toggle:hover {
    transform: scale(1.05);
}
#replypilot-chatbot-toggle-icon {
    font-size: 0px;

}
#replypilot-chatbot-toggle-icon img {
    width: 43px;
    height: auto;
}
/* User data form */
#replypilot-user-data-form {
    position: fixed;
    bottom: 90px;
    right: 20px;
    width: 390px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 5px 30px rgba(0, 0, 0, 0.2);
    z-index: 9999;
    padding: 20px;
    display: none;
    color: #2D3748;
    box-sizing: border-box;
    font-family: Arial, Helvetica, sans-serif;
}
#replypilot-user-data-form p {
    font-size: 16px;
}
#replypilot-user-data-form h3 {
    margin-top: 0;
    color: #4285f4;
    font-size: 26px;
}
#replypilot-user-data-form .form-group {
    margin-bottom: 15px;
}
#replypilot-user-data-form label {
    display: block;
    margin-bottom: 5px;
    font-weight: 500;
}
#replypilot-user-data-form input[type="text"],
#replypilot-user-data-form input[type="email"] {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
    box-sizing: border-box;
}
#replypilot-user-data-form button[type="submit"] {
    background: #4285f4;
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    width: 100%;
    transition: background 0.2s;
    font-weight: 400;
    text-transform: capitalize;
}
#replypilot-user-data-form button[type="submit"]:hover {
    background: #3367d6;
}
#replypilot-chatbot-messages .replypilot-service-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 10px;
}
#replypilot-chatbot-messages .replypilot-service-btn strong:hover {
    background: #f0f7ff;
    border-color: #4285f4;
}
#replypilot-chatbot-messages .replypilot-service-btn strong {
    color: #4285f4;
    font-size: 14px;
    padding: 5px 10px;
    border: 1px solid #ddd;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
    background: white;
    display: inline-block;
}
/* Responsive adjustments */
@media (max-width: 480px) {
    #replypilot-chatbot-container,
    #replypilot-user-data-form {
        width: 90%;
        right: 5%;
        bottom: 10px;
        max-height: 80vh;
    }
    #replypilot-chatbot-toggle {
        right: 5%;
        bottom: 10px;
    }
    .message {
        max-width: 90%;
    }
}