/* ==========================================================
   TELEGRAM BOT HERO
   Абстрактный диалог пользователя и бота
========================================================== */

.tg-bot-stage {
    position: relative;
    z-index: 2;
    height: 570px;
    min-height: 570px;
    display: flex;
    align-items: center;
    justify-content: center;
}


/* ----------------------------------
   PHONE
---------------------------------- */

.tg-phone {
    position: relative;
    z-index: 3;
    width: 292px;
    height: 545px;
    padding: 9px;
    border: 2px solid #17202c;
    border-radius: 38px;
    background: #111827;
    box-shadow:
        0 30px 70px rgba(15, 23, 42, .18),
        inset 0 0 0 1px rgba(255, 255, 255, .08);
    animation: tgPhoneReady 12s ease infinite;
}

.tg-phone::before {
    content: "";
    position: absolute;
    top: 86px;
    right: -5px;
    width: 4px;
    height: 62px;
    border-radius: 0 4px 4px 0;
    background: #253143;
}

.tg-phone::after {
    content: "";
    position: absolute;
    top: 78px;
    left: -5px;
    width: 4px;
    height: 39px;
    border-radius: 4px 0 0 4px;
    background: #253143;
}

.tg-phone-top {
    position: absolute;
    z-index: 20;
    top: 15px;
    left: 50%;
    width: 91px;
    height: 23px;
    border-radius: 20px;
    background: #0b1018;
    transform: translateX(-50%);
}

.tg-speaker {
    position: absolute;
    top: 9px;
    left: 31px;
    width: 31px;
    height: 4px;
    border-radius: 10px;
    background: #273243;
}

.tg-camera {
    position: absolute;
    top: 8px;
    right: 12px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #1d384a;
}


/* ----------------------------------
   SCREEN
---------------------------------- */

.tg-screen {
    position: relative;
    height: 100%;
    overflow: hidden;
    border-radius: 29px;
    background: #e8eef2;
}

.tg-statusbar {
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 15px 0;
    background: #fff;
    color: #1f2937;
}

.tg-statusbar > span {
    width: 24px;
    height: 5px;
    border-radius: 20px;
    background: #c4cdc8;
}

.tg-status-icons {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: .62rem;
}


/* ----------------------------------
   CHAT HEADER
---------------------------------- */

.tg-chat-header {
    height: 48px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-bottom: 1px solid #e3e9ed;
    background: #fff;
}

.tg-back-block {
    width: 10px;
    height: 10px;
    border-left: 2px solid #94a3b8;
    border-bottom: 2px solid #94a3b8;
    transform: rotate(45deg);
}

.tg-avatar {
    width: 33px;
    height: 33px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 33px;
    border-radius: 50%;
    background: var(--site-primary);
    color: #fff;
    font-size: .95rem;
}

.tg-contact-lines {
    flex: 1;
}

.tg-contact-lines span,
.tg-contact-lines i {
    display: block;
    border-radius: 20px;
}

.tg-contact-lines span {
    width: 68px;
    height: 6px;
    margin-bottom: 5px;
    background: #344154;
}

.tg-contact-lines i {
    width: 34px;
    height: 4px;
    background: #c5cec9;
}

.tg-menu-block {
    width: 4px;
    height: 18px;
    border-radius: 4px;
    background:
        radial-gradient(circle, #94a3b8 1.4px, transparent 1.6px);
    background-size: 4px 6px;
}


/* ----------------------------------
   CHAT
---------------------------------- */

.tg-chat {
    position: relative;
    height: 411px;
    padding: 12px 9px 16px;
    overflow: hidden;
    background:
        radial-gradient(
            circle at 20% 20%,
            rgba(15, 138, 75, .035) 0 2px,
            transparent 2px
        ),
        radial-gradient(
            circle at 70% 55%,
            rgba(15, 138, 75, .035) 0 2px,
            transparent 2px
        ),
        #e9eff2;
    background-size: 30px 30px, 42px 42px, auto;
}

.tg-date-block {
    width: 42px;
    height: 11px;
    margin: 0 auto 9px;
    border-radius: 12px;
    background: rgba(95, 115, 126, .22);
}


/* ----------------------------------
   BUBBLES
---------------------------------- */

.tg-bubble {
    width: fit-content;
    max-width: 82%;
    margin-bottom: 7px;
    padding: 9px;
    border-radius: 11px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .05);
    opacity: 0;
    transform: translateY(7px);
}

.tg-bubble-bot {
    margin-right: auto;
    border-bottom-left-radius: 3px;
    background: #fff;
}

.tg-bubble-user {
    margin-left: auto;
    border-bottom-right-radius: 3px;
    background: #d8f4df;
}

.tg-line {
    display: block;
    height: 5px;
    margin-bottom: 5px;
    border-radius: 20px;
    background: #b8c3bd;
}

.tg-bubble-user .tg-line {
    background: #91bca2;
}

.tg-line.long {
    width: 122px;
}

.tg-line.medium {
    width: 86px;
}

.tg-line.short {
    width: 52px;
}

.tg-bubble .tg-line:last-child {
    margin-bottom: 0;
}


/* ----------------------------------
   OPTIONS
---------------------------------- */

.tg-option-grid {
    display: grid;
    gap: 4px;
    margin-top: 8px;
}

.tg-option-grid span {
    display: block;
    width: 130px;
    height: 20px;
    border-radius: 6px;
    background: #edf7f1;
    border: 1px solid #d8ede1;
}


/* ----------------------------------
   POINTER
---------------------------------- */

.tg-pointer {
    position: absolute;
    z-index: 30;
    top: 214px;
    left: 230px;
    color: #111827;
    font-size: 1.3rem;
    opacity: 0;
    filter: drop-shadow(0 2px 2px rgba(15, 23, 42, .18));
    animation: tgPointerMove 12s ease-in-out infinite;
}


/* ----------------------------------
   TYPING
---------------------------------- */

.tg-typing {
    width: 39px;
    height: 25px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    margin: 0 auto 7px 0;
    border-radius: 10px 10px 10px 3px;
    background: #fff;
    opacity: 0;
    animation: tgTypingBox 12s ease infinite;
}

.tg-typing span {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: #94a3b8;
    animation: tgTypingDot 1s ease infinite;
}

.tg-typing span:nth-child(2) {
    animation-delay: .15s;
}

.tg-typing span:nth-child(3) {
    animation-delay: .3s;
}


/* ----------------------------------
   SUCCESS
---------------------------------- */

.tg-success-block {
    position: absolute;
    z-index: 20;
    right: 12px;
    bottom: 10px;
    left: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid #bfe0cc;
    border-radius: 9px;
    background: #eef9f2;
    opacity: 0;
    transform: translateY(12px);
    animation: tgSuccessShow 12s ease infinite;
}

.tg-success-icon {
    width: 23px;
    height: 23px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 23px;
    border-radius: 50%;
    background: var(--site-primary);
    color: #fff;
    font-size: .72rem;
}

.tg-success-block > div {
    flex: 1;
}

.tg-success-block > div span,
.tg-success-block > div i {
    display: block;
    border-radius: 20px;
}

.tg-success-block > div span {
    width: 90px;
    height: 5px;
    margin-bottom: 5px;
    background: #76a889;
}

.tg-success-block > div i {
    width: 58px;
    height: 4px;
    background: #b7d3c1;
}


/* ----------------------------------
   INPUT
---------------------------------- */

.tg-input {
    position: absolute;
    right: 6px;
    bottom: 6px;
    left: 6px;
    height: 37px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px;
    border-radius: 18px;
    background: #fff;
}

.tg-input-icon {
    width: 10px;
    height: 14px;
    border: 2px solid #a0aaa5;
    border-top-color: transparent;
    border-radius: 7px;
    transform: rotate(35deg);
}

.tg-input-line {
    flex: 1;
    height: 5px;
    border-radius: 20px;
    background: #d7ddda;
}

.tg-input-circle {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #d7ddda;
}

.tg-phone-bottom {
    position: absolute;
    z-index: 30;
    bottom: 15px;
    left: 50%;
    width: 82px;
    height: 4px;
    border-radius: 10px;
    background: rgba(0, 0, 0, .42);
    transform: translateX(-50%);
}


/* ----------------------------------
   MESSAGE SEQUENCE
---------------------------------- */

.tg-bubble-1 {
    animation: tgBubble1 12s ease infinite;
}

.tg-bubble-2 {
    animation: tgBubble2 12s ease infinite;
}

.tg-bubble-3 {
    animation: tgBubble3 12s ease infinite;
}

.tg-bubble-4 {
    animation: tgBubble4 12s ease infinite;
}

.tg-bubble-5 {
    animation: tgBubble5 12s ease infinite;
}

.tg-bubble-6 {
    animation: tgBubble6 12s ease infinite;
}

@keyframes tgBubble1 {
    0%, 4% {
        opacity: 0;
        transform: translateY(7px);
    }

    8%, 88% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
    }
}

@keyframes tgBubble2 {
    0%, 12% {
        opacity: 0;
        transform: translateY(7px);
    }

    17%, 88% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
    }
}

@keyframes tgBubble3 {
    0%, 21% {
        opacity: 0;
        transform: translateY(7px);
    }

    26%, 88% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
    }
}

@keyframes tgBubble4 {
    0%, 43% {
        opacity: 0;
        transform: translateY(7px);
    }

    48%, 88% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
    }
}

@keyframes tgBubble5 {
    0%, 57% {
        opacity: 0;
        transform: translateY(7px);
    }

    62%, 88% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
    }
}

@keyframes tgBubble6 {
    0%, 69% {
        opacity: 0;
        transform: translateY(7px);
    }

    74%, 88% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
    }
}


/* ----------------------------------
   POINTER MOVEMENT
---------------------------------- */

@keyframes tgPointerMove {
    0%, 29% {
        top: 210px;
        left: 235px;
        opacity: 0;
        transform: scale(1);
    }

    33% {
        opacity: 1;
    }

    37% {
        top: 242px;
        left: 132px;
        opacity: 1;
        transform: scale(1);
    }

    40% {
        transform: scale(.75);
    }

    43% {
        transform: scale(1);
    }

    49% {
        opacity: 1;
    }

    54%, 100% {
        opacity: 0;
    }
}


/* ----------------------------------
   TYPING
---------------------------------- */

@keyframes tgTypingBox {
    0%, 49% {
        opacity: 0;
        transform: translateY(5px);
    }

    52%, 57% {
        opacity: 1;
        transform: translateY(0);
    }

    60%, 100% {
        opacity: 0;
    }
}

@keyframes tgTypingDot {
    0%, 100% {
        opacity: .35;
        transform: translateY(0);
    }

    50% {
        opacity: 1;
        transform: translateY(-2px);
    }
}


/* ----------------------------------
   SUCCESS
---------------------------------- */

@keyframes tgSuccessShow {
    0%, 76% {
        opacity: 0;
        transform: translateY(12px);
    }

    81%, 89% {
        opacity: 1;
        transform: translateY(0);
    }

    96%, 100% {
        opacity: 0;
        transform: translateY(6px);
    }
}


/* ----------------------------------
   PHONE READY
---------------------------------- */

@keyframes tgPhoneReady {
    0%, 76% {
        box-shadow:
            0 30px 70px rgba(15, 23, 42, .18),
            inset 0 0 0 1px rgba(255, 255, 255, .08);
    }

    82%, 89% {
        box-shadow:
            0 30px 70px rgba(15, 23, 42, .18),
            0 0 0 5px rgba(15, 138, 75, .05),
            inset 0 0 0 1px rgba(255, 255, 255, .08);
    }

    96%, 100% {
        box-shadow:
            0 30px 70px rgba(15, 23, 42, .18),
            inset 0 0 0 1px rgba(255, 255, 255, .08);
    }
}


/* ----------------------------------
   MOBILE
---------------------------------- */

@media (max-width: 767.98px) {

    .tg-bot-stage {
        height: 520px;
        min-height: 520px;
    }

    .tg-phone {
        width: 263px;
        height: 495px;
        border-radius: 34px;
    }

    .tg-screen {
        border-radius: 26px;
    }

    .tg-chat {
        height: 361px;
    }

    .tg-pointer {
        display: none;
    }
}


/* ----------------------------------
   REDUCED MOTION
---------------------------------- */

@media (prefers-reduced-motion: reduce) {

    .tg-phone,
    .tg-bubble,
    .tg-typing,
    .tg-success-block,
    .tg-pointer {
        animation: none;
    }

    .tg-bubble {
        opacity: 1;
        transform: none;
    }

    .tg-bubble-5,
    .tg-bubble-6,
    .tg-typing,
    .tg-pointer {
        display: none;
    }

    .tg-success-block {
        opacity: 1;
        transform: none;
    }
}
