/* ==========================================================================
   Покупка докладов: корзина, попап, форма (smmconfa)
   Все селекторы с префиксом sc- / sc_, чтобы не конфликтовать со
   спецпредложением сайта (#special_offer_popup, #sticky_offer_bar).
   ========================================================================== */

/* Блокировка прокрутки, пока открыт попап или шторка */
body.sc-locked { overflow: hidden; }

#sc_cart_widget,
#sc_buy_popup,
#sc_cart_drawer,
#sc_overlay {
    font-family: "Liberation Sans", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Единая коробочная модель внутри виджета — не зависим от стилей темы */
#sc_cart_widget,
#sc_cart_widget *,
#sc_buy_popup,
#sc_buy_popup *,
#sc_cart_drawer,
#sc_cart_drawer *,
#sc_overlay {
    box-sizing: border-box;
}

/* ==========================================================================
   Оверлей под шторкой корзины
   ========================================================================== */
#sc_overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9100;
    display: none;
    background: rgba(0, 0, 0, 0.65);
}
#sc_overlay.sc-open { display: block; }

/* ==========================================================================
   Виджет корзины (круг справа сверху)
   ========================================================================== */
#sc_cart_widget {
    position: fixed;
    top: 100px;
    right: 20px;
    z-index: 8900;
    display: none;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}
#sc_cart_widget.sc-visible { display: flex; }

/* Главная без шапки: виджет поднимается выше */
body.sc-no-header #sc_cart_widget { top: 20px; }

#sc_cart_widget .sc-cart-widget__circle {
    position: relative;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 2px solid #FF3838;
    border-radius: 50%;
    background-color: rgba(16, 16, 16, 0.92);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.35);
    transition: background-color 0.2s ease, transform 0.2s ease;
}
#sc_cart_widget .sc-cart-widget__circle:hover { background-color: #FF3838; transform: translateY(-1px); }
#sc_cart_widget .sc-cart-widget__circle:active { transform: translateY(0); }
#sc_cart_widget .sc-cart-widget__circle svg { display: block; }

#sc_cart_widget .sc-cart-widget__btn {
    width: 100%;
    min-width: 0;
    padding: 8px 14px;
    border: 2px solid #FF3838;
    border-radius: 6px;
    background-color: rgba(16, 16, 16, 0.92);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.2;
    text-align: center;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color .2s ease, color .2s ease;
}
#sc_cart_widget .sc-cart-widget__btn:hover { background-color: #FF3838; color: #fff; }
#sc_cart_widget .sc-cart-widget__btn:disabled { opacity: .4; cursor: default; background-color: rgba(16, 16, 16, 0.92); }
#sc_cart_widget #sc_cart_buy { margin-top: 2px; }

#sc_cart_widget .sc-cart-widget__count {
    position: absolute;
    top: -5px;
    right: -5px;
    box-sizing: border-box;
    min-width: 24px;
    height: 24px;
    padding: 0 6px;
    border: 2px solid #101010;
    border-radius: 12px;
    background-color: #FF3838;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    line-height: 20px;
    text-align: center;
}
#sc_cart_widget .sc-cart-widget__count:empty { display: none; }

/* ==========================================================================
   Выдвижная корзина
   ========================================================================== */
/* Слой-обрезка: держит шторку за краем экрана, не создавая прокрутку */
#sc_cart_drawer_layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9200;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
}
#sc_cart_drawer_layer.sc-open { visibility: visible; }

#sc_cart_drawer {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    flex-direction: column;
    width: 420px;
    max-width: 94vw;
    height: 100vh;
    height: 100dvh;
    background-color: #101010;
    color: #fff;
    box-shadow: -12px 0 40px rgba(0, 0, 0, 0.55);
    transform: translateX(102%);
    transition: transform 0.3s ease;
    pointer-events: auto;
}
#sc_cart_drawer.sc-open { transform: translateX(0); }

#sc_cart_drawer .sc-drawer__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 22px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
#sc_cart_drawer .sc-drawer__title {
    font-size: 22px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}
#sc_cart_drawer .sc-drawer__close {
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: 50%;
    background: transparent;
    color: #fff;
    font-size: 24px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
#sc_cart_drawer .sc-drawer__close:hover { background-color: rgba(255, 255, 255, 0.12); border-color: rgba(255, 255, 255, 0.6); }

#sc_cart_drawer .sc-drawer__list {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 6px 22px;
    -webkit-overflow-scrolling: touch;
}
#sc_cart_drawer .sc-drawer__empty {
    padding: 48px 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 15px;
    line-height: 1.4;
}
#sc_cart_drawer .sc-drawer__row {
    display: grid;
    grid-template-columns: 24px minmax(0, 1fr) auto 28px;
    gap: 10px;
    align-items: center;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}
#sc_cart_drawer .sc-drawer__num {
    color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
}
#sc_cart_drawer .sc-drawer__info { min-width: 0; }
#sc_cart_drawer .sc-drawer__name {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    overflow-wrap: anywhere;
    word-break: break-word;
}
#sc_cart_drawer .sc-drawer__talk {
    margin-top: 3px;
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    line-height: 1.4;
    overflow-wrap: anywhere;
    word-break: break-word;
}
#sc_cart_drawer .sc-drawer__price {
    font-size: 14px;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}
#sc_cart_drawer .sc-drawer__del {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.65);
    font-size: 22px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.2s ease;
}
#sc_cart_drawer .sc-drawer__del:hover { color: #FF3838; }

#sc_cart_drawer .sc-drawer__foot {
    flex: 0 0 auto;
    padding: 18px 22px 24px;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    background-color: #0b0b0b;
}
#sc_cart_drawer .sc-drawer__bundle { display: flex; margin-bottom: 14px; }
#sc_cart_drawer .sc-drawer__bundle[hidden] { display: none; }
#sc_cart_drawer .sc-bundle__btn {
    position: relative;
    overflow: visible;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #FF3838;
    border-radius: 6px;
    background: transparent;
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    text-align: center;
    transition: background-color 0.2s ease, color 0.2s ease;
}
#sc_cart_drawer .sc-bundle__btn:hover { background-color: #FF3838; color: #fff; }

#sc_cart_drawer .sc-bundle__badge {
    position: absolute;
    left: -10px;
    top: -10px;
    transform: rotate(-30deg);
    transform-origin: center;
    z-index: 2;
    padding: 3px 10px;
    border-radius: 999px;
    background-color: #fff;
    color: #FF3838;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
    text-transform: none;
    white-space: nowrap;
    pointer-events: none;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

#sc_cart_drawer .sc-drawer__sum {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    line-height: 1.3;
}
#sc_cart_drawer .sc-drawer__sum strong {
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    white-space: nowrap;
}
#sc_cart_drawer .sc-drawer__checkout {
    width: 100%;
    height: 52px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background-color: #FF3838;
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
#sc_cart_drawer .sc-drawer__checkout:hover:not(:disabled) { background-color: #e02c2c; }
#sc_cart_drawer .sc-drawer__checkout:disabled { opacity: 0.5; cursor: not-allowed; }

/* ==========================================================================
   Попап покупки
   ========================================================================== */
#sc_buy_popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9500;
    display: none;
    overflow-y: auto;
    padding: 24px 16px;
    background-color: rgba(0, 0, 0, 0.72);
    -webkit-overflow-scrolling: touch;
}
#sc_buy_popup.sc-open { display: flex; align-items: flex-start; justify-content: center; }

#sc_buy_popup .sc-popup__dialog {
    position: relative;
    width: 100%;
    max-width: 520px;
    margin: auto;
    padding: 36px 34px 30px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background-color: #101010;
    color: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
}

#sc_buy_popup .sc-popup__close {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}
#sc_buy_popup .sc-popup__close:hover { background-color: rgba(255, 255, 255, 0.1); color: #fff; }

#sc_buy_popup .sc-popup__title {
    margin: 0 0 8px;
    padding: 0 26px;
    font-size: 22px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    text-align: center;
    text-transform: none;
    overflow-wrap: anywhere;
    word-break: break-word;
}
#sc_buy_popup .sc-popup__speaker {
    margin: 0 0 16px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 15px;
    line-height: 1.35;
    text-align: center;
    overflow-wrap: anywhere;
    word-break: break-word;
}
#sc_buy_popup .sc-popup__price {
    margin: 0;
    color: #FF3838;
    font-size: 34px;
    font-weight: 700;
    line-height: 1.1;
    text-align: center;
}
#sc_buy_popup .sc-popup__error {
    margin: 14px 0 0;
    padding: 10px 12px;
    border: 1px solid rgba(255, 56, 56, 0.5);
    border-radius: 6px;
    background-color: rgba(255, 56, 56, 0.1);
    color: #ff8a8a;
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
}
#sc_buy_popup .sc-popup__error[hidden] { display: none; }

#sc_buy_popup .sc-form { margin-top: 20px; }
#sc_buy_popup .sc-field { margin-bottom: 12px; }
#sc_buy_popup .sc-input {
    display: block;
    width: 100%;
    height: 54px;
    padding: 0 16px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 6px;
    background-color: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-family: inherit;
    font-size: 16px;
    line-height: 1.2;
    transition: border-color 0.2s ease, background-color 0.2s ease;
}
#sc_buy_popup .sc-input::placeholder { color: rgba(255, 255, 255, 0.45); opacity: 1; }
#sc_buy_popup .sc-input:focus {
    border-color: #FF3838;
    background-color: rgba(255, 255, 255, 0.07);
    outline: none;
}
#sc_buy_popup .sc-input.sc-error { border-color: #FF3838; }
#sc_buy_popup .sc-input:-webkit-autofill {
    -webkit-text-fill-color: #fff;
    -webkit-box-shadow: 0 0 0 1000px #1a1a1a inset;
    caret-color: #fff;
}

#sc_buy_popup .sc-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    cursor: pointer;
}
#sc_buy_popup .sc-checkbox input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
}
#sc_buy_popup .sc-checkbox__box {
    position: relative;
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    border: 1px solid rgba(255, 255, 255, 0.45);
    border-radius: 3px;
    background-color: transparent;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}
#sc_buy_popup .sc-checkbox input:checked + .sc-checkbox__box {
    border-color: #FF3838;
    background-color: #FF3838;
}
#sc_buy_popup .sc-checkbox input:checked + .sc-checkbox__box::after {
    content: "";
    position: absolute;
    left: 5px;
    top: 1px;
    width: 5px;
    height: 9px;
    border-right: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(45deg);
}
#sc_buy_popup .sc-checkbox input:focus-visible + .sc-checkbox__box {
    outline: 2px solid #FF3838;
    outline-offset: 2px;
}
#sc_buy_popup .sc-checkbox.sc-error .sc-checkbox__box { border-color: #FF3838; }
#sc_buy_popup .sc-checkbox__text {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
    line-height: 1.45;
}
#sc_buy_popup .sc-checkbox__text a { color: #FF3838; text-decoration: underline; }
#sc_buy_popup .sc-checkbox__text a:hover { text-decoration: none; }

#sc_buy_popup .sc-submit {
    display: block;
    width: 100%;
    height: 54px;
    margin-top: 16px;
    padding: 0 16px;
    border: 0;
    border-radius: 6px;
    background-color: #FF3838;
    color: #fff;
    font-family: inherit;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    cursor: pointer;
    transition: background-color 0.2s ease, opacity 0.2s ease;
}
#sc_buy_popup .sc-submit:hover:not(:disabled) { background-color: #e02c2c; }
#sc_buy_popup .sc-submit:disabled { opacity: 0.65; cursor: not-allowed; }

#sc_buy_popup .sc-popup__more {
    display: block;
    margin-top: 14px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 13px;
    line-height: 1.4;
    text-align: center;
    text-decoration: underline;
}
#sc_buy_popup .sc-popup__more:hover { color: #fff; }

/* Ловушка для ботов: поле есть в DOM, но не видно человеку */
#sc_buy_popup .sc-hp {
    position: absolute;
    left: -9999px;
    top: auto;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ==========================================================================
   Фокус с клавиатуры
   ========================================================================== */
#sc_cart_widget .sc-cart-widget__circle:focus-visible,
#sc_cart_widget .sc-cart-widget__btn:focus-visible,
#sc_cart_drawer .sc-drawer__close:focus-visible,
#sc_cart_drawer .sc-drawer__del:focus-visible,
#sc_cart_drawer .sc-bundle__btn:focus-visible,
#sc_cart_drawer .sc-drawer__checkout:focus-visible,
#sc_buy_popup .sc-popup__close:focus-visible,
#sc_buy_popup .sc-popup__more:focus-visible {
    outline: 2px solid #FF3838;
    outline-offset: 2px;
}
#sc_buy_popup .sc-submit:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ==========================================================================
   Мобильная версия
   ========================================================================== */
@media (max-width: 641px) {
    #sc_cart_widget { right: 14px; }
    #sc_cart_widget #sc_cart_show { display: none; }

    #sc_cart_drawer { width: 100%; max-width: 100vw; }
    #sc_cart_drawer .sc-drawer__head { padding: 18px 16px 14px; }
    #sc_cart_drawer .sc-drawer__title { font-size: 20px; }
    #sc_cart_drawer .sc-drawer__list { padding: 4px 16px; }
    #sc_cart_drawer .sc-drawer__row { grid-template-columns: 20px minmax(0, 1fr) auto 26px; gap: 8px; }
    #sc_cart_drawer .sc-drawer__foot { padding: 14px 16px 20px; }
    #sc_cart_drawer .sc-bundle__btn { font-size: 15px; }
    #sc_cart_drawer .sc-drawer__sum { font-size: 16px; }
    #sc_cart_drawer .sc-drawer__sum strong { font-size: 20px; }

    #sc_buy_popup { padding: 0; }
    #sc_buy_popup .sc-popup__dialog {
        max-width: none;
        min-height: 100%;
        padding: 28px 18px 24px;
        border: 0;
        border-radius: 0;
    }
    #sc_buy_popup .sc-popup__title { font-size: 20px; }
    #sc_buy_popup .sc-popup__price { font-size: 30px; }
}
