
/* =========================================
   SIM 05 — ОНЛАЙН-ЧАТ
========================================= */

#sim05-chat-launch {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99990;

    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;

    box-sizing: border-box;
    width: auto;
    height: 62px;
    min-width: 0;
    padding: 13px 19px 13px 14px;

    border: 1px solid #e9c900;
    border-radius: 30px;

    background: linear-gradient(135deg, #ffe84a, #ffdc00 65%, #f2c900);
    color: #111;

    font: 800 14px Arial, sans-serif;
    white-space: nowrap;
    overflow: hidden;

    box-shadow: 0 10px 30px #0005, 0 0 0 1px #fff5 inset;
    cursor: pointer;

    transition:
        width .25s ease,
        height .25s ease,
        padding .25s ease,
        border-radius .25s ease,
        gap .25s ease,
        transform .2s ease,
        box-shadow .2s ease;
}

#sim05-chat-launch:hover {
    transform: translateY(-3px);
    box-shadow: 0 14px 35px #0007, 0 0 0 1px #fff8 inset;
}

#sim05-chat-launch svg {
    width: 23px;
    height: 23px;
    display: block;
}

.s05-launch-icon {
    display: grid;
    place-items: center;
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: #111;
    color: #ffdf00;
}

.s05-launch-dot {
    flex: 0 0 8px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #20a65a;
    box-shadow: 0 0 0 3px #20a65a30;
}

/* КОМПАКТНАЯ КНОПКА */

#sim05-chat-launch.is-compact {
    width: 54px !important;
    min-width: 54px !important;
    max-width: 54px !important;
    height: 54px !important;

    padding: 9px !important;
    gap: 0 !important;

    border-radius: 50% !important;
    justify-content: center !important;
    overflow: hidden !important;
}

#sim05-chat-launch.is-compact > span:nth-of-type(2),
#sim05-chat-launch.is-compact .s05-launch-dot {
    display: none !important;
}

#sim05-chat-launch.is-compact .s05-launch-icon {
    flex: 0 0 34px !important;
    width: 34px !important;
    height: 34px !important;
}

/* =========================================
   ОКНО ЧАТА
========================================= */

#sim05-chat-box {
    position: fixed;
    right: 24px;
    bottom: 91px;
    z-index: 99991;

    box-sizing: border-box;
    width: min(385px, calc(100vw - 28px));
    height: min(590px, calc(100vh - 125px));

    background: #111318;
    color: #f8f8fa;

    border: 1px solid #ffdc0066;
    border-radius: 22px;

    box-shadow: 0 22px 65px #000a, 0 0 35px #ffdc0015;

    display: none;
    overflow: hidden;

    font: 14px/1.45 Arial, sans-serif;
}

#sim05-chat-box.open {
    display: flex;
    flex-direction: column;
    animation: s05chat-in .22s ease-out;
}

@keyframes s05chat-in {
    from {
        opacity: 0;
        transform: translateY(12px) scale(.98);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

#sim05-chat-box * {
    box-sizing: border-box;
}

/* ШАПКА */

#sim05-chat-head {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px 14px;

    background: linear-gradient(115deg, #ffdc00, #ffe94b);
    color: #111;
    overflow: hidden;
}

#sim05-chat-head:after {
    content: "";
    position: absolute;
    right: -24px;
    top: -38px;
    width: 130px;
    height: 130px;
    border: 17px solid #111;
    opacity: .055;
    border-radius: 50%;
}

.s05-brand-mark {
    width: 39px;
    height: 39px;
    display: grid;
    place-items: center;
    border-radius: 12px;
    background: #111;
    color: #ffdc00;
    font-weight: 900;
    font-size: 15px;
    letter-spacing: -1px;
    box-shadow: 0 3px 10px #0002;
}

.s05-head-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.s05-head-copy strong {
    font-size: 15px;
}

.s05-head-copy small {
    font-size: 11px;
    color: #34300e;
}

.s05-head-copy small i {
    display: inline-block;
    width: 7px;
    height: 7px;
    background: #138c49;
    border-radius: 50%;
    margin-right: 4px;
}

.s05-messenger-icons {
    display: flex;
    gap: 5px;
    align-items: center;
}

.s05-messenger-icons span {
    width: 25px;
    height: 25px;
    border-radius: 50%;
    background: #111;
    color: #ffdc00;
    display: grid;
    place-items: center;
}

.s05-messenger-icons svg {
    width: 15px;
    height: 15px;
}

#sim05-chat-close {
    position: relative;
    z-index: 1;
    background: #111;
    color: #ffdc00;
    border: 0;
    border-radius: 50%;
    width: 29px;
    height: 29px;
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
}

/* ПРИВЕТСТВИЕ */

.s05-chat-welcome {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 12px 15px;
    background: #1b1e25;
    border-bottom: 1px solid #ffffff12;
}

.s05-chat-welcome b {
    font-size: 13px;
    color: #ffdf24;
}

.s05-chat-welcome span {
    font-size: 12px;
    color: #b8bac2;
}

/* СООБЩЕНИЯ */

#sim05-chat-messages {
    padding: 13px;
    overflow: auto;
    flex: 1;
    min-height: 90px;

    background:
        radial-gradient(ellipse at top right, #ffdc0008, transparent 55%),
        #111318;
}

#sim05-chat-messages .s05-msg {
    position: relative;
    max-width: 88%;
    padding: 10px 12px;
    border-radius: 15px 15px 15px 4px;
    margin: 8px 0;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    background: #292d36;
    color: #f5f5f6;
    box-shadow: 0 3px 9px #0002;
}

#sim05-chat-messages .s05-msg.staff {
    margin-left: auto;
    border-radius: 15px 15px 4px 15px;
    background: #ffdf25;
    color: #171717;
}

#sim05-chat-messages small {
    display: block;
    color: #aaa;
    font-size: 10px;
    margin-top: 5px;
}

#sim05-chat-messages .s05-msg.staff small {
    color: #625600;
}

/* ФОРМА */

#sim05-chat-form {
    padding: 10px 12px 8px;
    background: #191c22;
    border-top: 1px solid #ffffff16;
}

#sim05-chat-form input,
#sim05-chat-form textarea {
    width: 100%;
    margin: 4px 0;
    padding: 11px 12px;
    border: 1px solid #ffffff24;
    border-radius: 11px;
    background: #101217;
    color: #fff;
    font: 13px Arial;
    outline: none;
}

#sim05-chat-form input:focus,
#sim05-chat-form textarea:focus {
    border-color: #ffdc00;
}

#sim05-chat-form textarea {
    resize: none;
    height: 58px;
    min-height: 58px;
}

.s05-compose {
    display: flex;
    align-items: flex-end;
    gap: 8px;
}

.s05-compose textarea {
    flex: 1;
    margin: 0 !important;
}

.s05-compose button {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 13px;
    background: #ffdc00;
    color: #111;
    cursor: pointer;
    box-shadow: 0 3px 10px #ffdc0025;
}

.s05-compose button svg {
    width: 22px;
    height: 22px;
}

.s05-compose button:disabled {
    opacity: .45;
    cursor: wait;
}

#sim05-chat-note {
    font-size: 11px;
    color: #a7a9b0;
    margin: 3px 0 7px;
}

#sim05-chat-error {
    color: #ffc0c0;
    font-size: 11px;
    min-height: 15px;
    margin-top: 5px;
}

.s05-chat-foot {
    text-align: center;
    color: #747780;
    font-size: 10px;
    padding-top: 2px;
}

#sim05-chat-onboarding[hidden] {
    display: none !important;
}

/* НОВОЕ СООБЩЕНИЕ */

#sim05-chat-launch.has-new {
    animation: s05chatpulse 1.15s infinite;
    box-shadow: 0 0 0 6px #ffdc0033, 0 10px 30px #0006;
}

@keyframes s05chatpulse {
    50% {
        transform: scale(1.045);
    }
}

/* МОБИЛЬНЫЕ УСТРОЙСТВА */

@media (max-width: 760px) {
    #sim05-chat-launch {
        right: 14px !important;
        bottom: 90px !important;
    }

    #sim05-chat-box {
        /* Окно всегда одинакового размера и строго по центру экрана */
        position: fixed !important;
        left: calc(50% + var(--s05-chat-offset-x, 0px)) !important;
        right: auto !important;
        top: calc(50% + var(--s05-chat-offset-y, 0px)) !important;
        bottom: auto !important;
        width: var(--s05-chat-fixed-width, min(385px, calc(100vw - 32px))) !important;
        height: var(--s05-chat-fixed-height, min(590px, calc(100svh - 32px))) !important;
        max-height: none !important;
        transform: translate(-50%, -50%);
        border-radius: 20px;
    }

    #sim05-chat-box.open {
        animation: s05chat-mobile-in .22s ease-out;
    }

    @keyframes s05chat-mobile-in {
        from { opacity: 0; }
        to { opacity: 1; }
    }

    /* iOS Safari автоматически увеличивает страницу при фокусе на полях меньше 16px. */
    #sim05-chat-form input,
    #sim05-chat-form textarea {
        font-size: 16px;
        line-height: 1.35;
    }
}

@media (max-width: 480px) {
    #sim05-chat-launch {
        padding: 11px 15px 11px 11px;
    }

    #sim05-chat-box {
        border-radius: 19px;
    }
}

/* Повторное обращение после завершения диалога */
#s05-chat-new {display:block;width:100%;margin-top:7px;padding:9px;border:1px solid #ffdc00;border-radius:9px;background:#242116;color:#ffdc00;font-weight:700;cursor:pointer}
#s05-chat-new[hidden] {display:none !important}
#s05-chat-new:disabled {opacity:.5;cursor:wait}

#s05-staff-typing {font:italic 11px Arial,sans-serif;color:#ffdc00;background:#111318;padding:3px 13px 5px;}
#s05-staff-typing[hidden] {display:none !important;}

/* SIM 05 — гостевой переключатель звуковых уведомлений, V8 */
#sim05-chat-sound {
  position:relative;z-index:2;flex:0 0 30px;width:30px;height:30px;
  display:inline-grid;place-items:center;padding:0;cursor:pointer;
  border:1px solid #1116;border-radius:50%;background:#111;color:#ffdc00;
  font-size:15px;line-height:1;transition:transform .2s ease,background .2s ease;
}
#sim05-chat-sound:hover { transform:scale(1.06); }
#sim05-chat-sound:focus-visible { outline:3px solid #111;outline-offset:2px; }
#sim05-chat-sound[aria-pressed="false"] { background:#504b25;color:#faf5cf; }
#sim05-chat-sound span { display:block;line-height:1; }
@media (max-width:480px) {
  #sim05-chat-head { gap:8px;padding:12px 11px; }
  #sim05-chat-head .s05-messenger-icons { display:none; }
  #sim05-chat-sound { flex-basis:30px; }
}
