:root {
    --wstc-primary: #24A1DE;
}

/* --- WP Smart Telegram Chat Widget --- */
.wstc-widget {
    position: fixed;
    z-index: 9999;
    font-family: inherit;
}

/* Positioning */
.pos-bottom-right {
    bottom: 2rem;
    right: 2rem;
}

.pos-bottom-left {
    bottom: 2rem;
    left: 2rem;
}

.pos-middle-right {
    top: 50%;
    right: 0;
    transform: translateY(-50%);
}

/* Launch Button */
.wstc-launch-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: var(--wstc-primary);
    /* Telegram Blue */
    border: none;
    box-shadow: 0 4px 15px rgba(36, 161, 222, 0.4);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    animation: wstc-pulse 3s infinite;
    color: white;
}

/* Sticky Style Override */
.pos-middle-right .wstc-launch-btn {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    width: 50px;
    height: 50px;
    padding-left: 5px;
    /* Visual balance */
    box-shadow: -4px 4px 15px rgba(36, 161, 222, 0.4);
}

.wstc-launch-btn:hover {
    transform: scale(1.1);
}

.pos-middle-right .wstc-launch-btn:hover {
    transform: translateX(-5px);
    /* Slide out slightly */
}

/* Badge */
.wstc-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff3b30;
    color: white;
    font-size: 11px;
    font-weight: bold;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid white;
}

.pos-middle-right .wstc-badge {
    top: -5px;
    right: auto;
    left: -5px;
}

@keyframes wstc-pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(36, 161, 222, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(36, 161, 222, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(36, 161, 222, 0);
    }
}

/* Chat Box */
.wstc-chat-box {
    position: absolute;
    bottom: 80px;
    /* Default for bottom positions */
    right: 0;
    width: 320px;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    transform: scale(0);
    transform-origin: bottom right;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    opacity: 0;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(0, 0, 0, 0.1);
}

/* Adjust Origin for other positions */
.pos-bottom-left .wstc-chat-box {
    right: auto;
    left: 0;
    transform-origin: bottom left;
}

.pos-middle-right .wstc-chat-box {
    bottom: auto;
    top: 50%;
    /* Center relative to button */
    right: 70px;
    transform: translateY(-50%) scale(0);
    transform-origin: center right;
}

.wstc-chat-box.open {
    transform: scale(1);
    opacity: 1;
}

.pos-middle-right .wstc-chat-box.open {
    transform: translateY(-50%) scale(1);
}


/* Chat Header */
.wstc-header {
    background: var(--wstc-primary);
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    color: white;
    position: relative;
}

.wstc-avatar {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    /* For circular avatar */
}

.wstc-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.wstc-info {
    display: flex;
    flex-direction: column;
}

.wstc-name {
    font-weight: 700;
    font-size: 1rem;
}

.wstc-status {
    font-size: 0.75rem;
    opacity: 0.9;
}

.wstc-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s;
}

.wstc-close:hover {
    opacity: 1;
}

/* Chat Body */
.wstc-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 350px;
    background: #f8fafc;
    overflow-y: auto;
}

.wstc-footer {
    padding: 12px 15px;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    border-radius: 0 0 20px 20px;
    position: relative;
    z-index: 10;
}

.wstc-suggestions {
    position: absolute;
    bottom: 100%;
    left: 0;
    width: 100%;
    background: #ffffff;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    max-height: 180px;
    overflow-y: auto;
    display: none;
    flex-direction: column;
    box-shadow: 0 -10px 20px rgba(0, 0, 0, 0.05);
    border-radius: 15px 15px 0 0;
}

.wstc-suggestion-item {
    padding: 12px 15px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #f8f9fa;
    transition: all 0.2s;
    color: #444;
}

.wstc-suggestion-item:hover {
    background: #f0f7ff;
    color: var(--wstc-primary);
}

.wstc-input-wrapper {
    display: flex;
    align-items: center;
    background: #f1f5f9;
    border-radius: 25px;
    padding: 2px 8px 2px 15px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}

.wstc-input-wrapper:focus-within {
    border-color: var(--wstc-primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(36, 161, 222, 0.1);
}

#wstc-user-input {
    flex: 1;
    border: none;
    background: transparent;
    padding: 10px 0;
    font-size: 14px;
    outline: none;
    color: #333;
    width: 100%;
}

.wstc-send-btn {
    border: none;
    background: transparent;
    color: var(--wstc-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    transition: all 0.2s;
    border-radius: 50%;
}

.wstc-send-btn:hover {
    transform: scale(1.1);
    background: rgba(36, 161, 222, 0.1);
}

.wstc-messages {
    flex: 1;
    overflow-y: auto;
    padding-bottom: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.wstc-message {
    max-width: 85%;
    padding: 0.75rem 1rem;
    border-radius: 15px;
    font-size: 0.9rem;
    line-height: 1.4;
    word-wrap: break-word;
    animation: wstcFadeIn 0.3s ease;
    background: white;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    color: #334155;
}

.bot-msg {
    border-bottom-left-radius: 5px;
    align-self: flex-start;
}

.user-msg {
    background: var(--wstc-primary);
    color: white;
    border-bottom-right-radius: 5px;
    align-self: flex-end;
}

.wstc-quick-replies {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.wstc-chip {
    background: white;
    border: 1px solid var(--wstc-primary);
    color: var(--wstc-primary);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s;
}

.wstc-chip:hover {
    background: var(--wstc-primary);
    color: white;
}

.wstc-message a {
    color: var(--wstc-primary);
    text-decoration: underline;
}

.wstc-message img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 8px 0;
    display: block;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

@keyframes wstcFadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- Image Modal --- */
.wstc-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(5px);
    cursor: zoom-out;
    /* Centering */
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.wstc-modal-content {
    margin: auto;
    display: block;
    width: auto;
    max-width: 90%;
    max-height: 80vh;
    animation: wstcZoom 0.3s ease;
    border-radius: 10px;
    box-shadow: 0 0 30px rgba(0, 0, 0, 0.5);
    cursor: default;
}

@keyframes wstcZoom {
    from {
        transform: scale(0.7);
        opacity: 0;
    }

    to {
        transform: scale(1);
        opacity: 1;
    }
}

.wstc-modal-close {
    position: absolute;
    top: 20px;
    right: 35px;
    color: #f1f1f1;
    font-size: 40px;
    font-weight: bold;
    transition: 0.3s;
    cursor: pointer;
}

.wstc-modal-close:hover {
    color: #bbb;
    text-decoration: none;
}

/* Mobile Adjustments for Modal */
@media only screen and (max-width: 700px) {
    .wstc-modal-content {
        width: 95%;
    }
}

/* Mobile Tweak */
@media (max-width: 480px) {
    .wstc-chat-box {
        width: 300px;
        right: -10px;
    }

    .pos-middle-right .wstc-chat-box {
        right: 60px;
        /* Tighter on mobile */
    }
}