/**
 * Frontpad WC — баннер согласия на cookie.
 *
 * Плоский стиль, шрифт берётся из темы. Важные свойства закреплены (!important),
 * потому что темы часто задают свои стили всем <button>, <p>, <label> и <input> —
 * без этого кнопки распухают, текст прыгает и баннер перестаёт помещаться.
 */

/* ---------------------------------------------------------- переменные */

.fpwc-cc,
.fpwc-cc-prefs,
.fpwc-cc-reopen {
    --fpwc-cc-bg: #ffffff;
    --fpwc-cc-ink: #14202b;
    --fpwc-cc-muted: #5d6975;
    --fpwc-cc-line: #dce1e7;
    --fpwc-cc-soft: #f2f4f7;
    --fpwc-cc-tint: color-mix(in srgb, var(--fpwc-cc-accent, #00528a) 12%, var(--fpwc-cc-bg));
    --fpwc-cc-on-accent: #ffffff;
    --fpwc-cc-radius: 14px;
    --fpwc-cc-gap: 16px;
}

.fpwc-cc--dark {
    --fpwc-cc-bg: #18222c;
    --fpwc-cc-ink: #eef2f6;
    --fpwc-cc-muted: #a7b2bd;
    --fpwc-cc-line: #2e3b48;
    --fpwc-cc-soft: #222e3a;
}

.fpwc-cc[hidden],
.fpwc-cc-prefs[hidden],
.fpwc-cc-reopen[hidden] {
    display: none !important;
}

/* ------------------------------------------------- защита от стилей темы */

.fpwc-cc,
.fpwc-cc *,
.fpwc-cc *::before,
.fpwc-cc *::after,
.fpwc-cc-prefs,
.fpwc-cc-prefs *,
.fpwc-cc-prefs *::before,
.fpwc-cc-prefs *::after,
.fpwc-cc-reopen,
.fpwc-cc-reopen * {
    box-sizing: border-box !important;
}

.fpwc-cc,
.fpwc-cc-prefs,
.fpwc-cc-reopen {
    font-family: inherit !important;
    font-size: 15px !important;
    font-style: normal !important;
    line-height: 1.5 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-align: left !important;
    color: var(--fpwc-cc-ink) !important;
    -webkit-font-smoothing: antialiased;
}

.fpwc-cc p,
.fpwc-cc-prefs p {
    margin: 0 !important;
    padding: 0 !important;
    font-family: inherit !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-indent: 0 !important;
}

.fpwc-cc svg,
.fpwc-cc-prefs svg,
.fpwc-cc-reopen svg {
    display: block !important;
    flex: none !important;
    max-width: none !important;
    fill: none;
}

/* ------------------------------------------------------------- баннер */

.fpwc-cc__banner {
    position: fixed !important;
    z-index: 99990 !important;
    margin: 0 !important;
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    overflow-y: auto !important;
    overscroll-behavior: contain;
    background: var(--fpwc-cc-bg) !important;
    color: var(--fpwc-cc-ink) !important;
    border: 1px solid var(--fpwc-cc-line) !important;
    box-shadow: none !important;
    animation: fpwc-cc-in .28s ease-out both;
}

.fpwc-cc__inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "icon body actions";
    align-items: center;
    gap: var(--fpwc-cc-gap) 24px;
}

.fpwc-cc__icon {
    grid-area: icon;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 44px !important;
    height: 44px !important;
    border-radius: 12px !important;
    background: var(--fpwc-cc-tint) !important;
    color: var(--fpwc-cc-accent, #00528a) !important;
}

.fpwc-cc__body {
    grid-area: body;
    min-width: 0;
}

.fpwc-cc .fpwc-cc__title {
    margin: 0 0 2px !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.35 !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc .fpwc-cc__text {
    font-size: 14px !important;
    font-weight: 400 !important;
    line-height: 1.5 !important;
    color: var(--fpwc-cc-muted) !important;
    overflow-wrap: anywhere;
}

.fpwc-cc .fpwc-cc__text a {
    color: var(--fpwc-cc-ink) !important;
    font-weight: inherit !important;
    text-decoration: underline !important;
    text-underline-offset: 2px;
    border: 0 !important;
    box-shadow: none !important;
}

.fpwc-cc__actions {
    grid-area: actions;
    display: flex !important;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

/* Полоса внизу экрана */
.fpwc-cc--bar .fpwc-cc__banner {
    left: 0 !important;
    right: 0 !important;
    bottom: var(--fpwc-cc-offset, 0px) !important;
    width: auto !important;
    padding: 16px 24px !important;
    border-width: 1px 0 !important;
    border-radius: 0 !important;
}

.fpwc-cc--bar .fpwc-cc__inner {
    max-width: 1200px;
    margin: 0 auto;
}

/* Карточка в углу и окно по центру — компактная раскладка */
.fpwc-cc--box-left .fpwc-cc__banner,
.fpwc-cc--box-right .fpwc-cc__banner,
.fpwc-cc--modal .fpwc-cc__banner {
    width: min(420px, calc(100vw - 32px)) !important;
    padding: 20px !important;
    border-radius: var(--fpwc-cc-radius) !important;
}

.fpwc-cc--box-left .fpwc-cc__banner,
.fpwc-cc--box-right .fpwc-cc__banner {
    bottom: calc(20px + var(--fpwc-cc-offset, 0px)) !important;
}

.fpwc-cc--box-left .fpwc-cc__banner { left: 20px !important; }
.fpwc-cc--box-right .fpwc-cc__banner { right: 20px !important; }

.fpwc-cc--modal .fpwc-cc__banner {
    top: 50% !important;
    left: 50% !important;
    width: min(480px, calc(100vw - 32px)) !important;
    padding: 24px !important;
    transform: translate(-50%, -50%);
    animation-name: fpwc-cc-in-center;
}

.fpwc-cc--box-left .fpwc-cc__inner,
.fpwc-cc--box-right .fpwc-cc__inner,
.fpwc-cc--modal .fpwc-cc__inner {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas:
        "icon body"
        "actions actions";
    align-items: start;
    gap: 16px 14px;
}

.fpwc-cc--box-left .fpwc-cc__icon,
.fpwc-cc--box-right .fpwc-cc__icon,
.fpwc-cc--modal .fpwc-cc__icon {
    width: 40px !important;
    height: 40px !important;
}

/* В компактной раскладке кнопки на всю ширину: главная сверху */
.fpwc-cc--box-left .fpwc-cc__actions,
.fpwc-cc--box-right .fpwc-cc__actions,
.fpwc-cc--modal .fpwc-cc__actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
}

.fpwc-cc--box-left .fpwc-cc__btn--primary,
.fpwc-cc--box-right .fpwc-cc__btn--primary,
.fpwc-cc--modal .fpwc-cc__btn--primary {
    grid-column: 1 / -1;
    order: -1;
}

.fpwc-cc--box-left .fpwc-cc__actions .fpwc-cc__btn:only-of-type,
.fpwc-cc--box-right .fpwc-cc__actions .fpwc-cc__btn:only-of-type,
.fpwc-cc--modal .fpwc-cc__actions .fpwc-cc__btn:only-of-type {
    grid-column: 1 / -1;
}

/* если второстепенная кнопка одна — тоже на всю ширину */
.fpwc-cc__actions:not(:has(.fpwc-cc__btn--link)) .fpwc-cc__btn--secondary,
.fpwc-cc__actions:not(:has(.fpwc-cc__btn--secondary)) .fpwc-cc__btn--link {
    grid-column: 1 / -1;
}

.fpwc-cc__backdrop {
    position: fixed !important;
    inset: 0 !important;
    z-index: 99989 !important;
    margin: 0 !important;
    background: rgba(10, 18, 26, .45) !important;
}

html.fpwc-cc-pos-modal,
html.fpwc-cc-prefs-open {
    overflow: hidden;
}

/* Полоса не закрывает подвал сайта: снизу появляется место под неё */
html.fpwc-cc-pos-bar body {
    padding-bottom: var(--fpwc-cc-h, 0px) !important;
}

/* Плавающие кнопки сайта поднимаются над баннером */
html.fpwc-cc-pos-bar #smorya-floating-btn,
html.fpwc-cc-pos-box-left #smorya-floating-btn {
    bottom: calc(var(--fpwc-cc-h, 0px) + 16px) !important;
    transition: bottom .2s ease;
}

/* ------------------------------------------------------------- кнопки */

.fpwc-cc .fpwc-cc__btn,
.fpwc-cc-prefs .fpwc-cc__btn {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: static !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    float: none !important;
    width: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 44px !important;
    margin: 0 !important;
    padding: 10px 18px !important;
    border: 1px solid transparent !important;
    border-radius: 10px !important;
    background: none !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: 14px !important;
    font-weight: 600 !important;
    font-style: normal !important;
    line-height: 1.25 !important;
    letter-spacing: normal !important;
    text-transform: none !important;
    text-decoration: none !important;
    text-align: center !important;
    text-shadow: none !important;
    white-space: normal !important;
    overflow-wrap: anywhere;
    cursor: pointer !important;
    transform: none !important;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.fpwc-cc .fpwc-cc__btn--primary,
.fpwc-cc-prefs .fpwc-cc__btn--primary {
    background: var(--fpwc-cc-accent, #00528a) !important;
    border-color: var(--fpwc-cc-accent, #00528a) !important;
    color: var(--fpwc-cc-on-accent) !important;
}

.fpwc-cc .fpwc-cc__btn--primary:hover,
.fpwc-cc-prefs .fpwc-cc__btn--primary:hover {
    background: color-mix(in srgb, var(--fpwc-cc-accent, #00528a) 85%, #000) !important;
    border-color: color-mix(in srgb, var(--fpwc-cc-accent, #00528a) 85%, #000) !important;
    color: var(--fpwc-cc-on-accent) !important;
}

.fpwc-cc .fpwc-cc__btn--secondary,
.fpwc-cc-prefs .fpwc-cc__btn--secondary {
    background: var(--fpwc-cc-bg) !important;
    border-color: var(--fpwc-cc-line) !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc .fpwc-cc__btn--secondary:hover,
.fpwc-cc-prefs .fpwc-cc__btn--secondary:hover {
    background: var(--fpwc-cc-soft) !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc .fpwc-cc__btn--link {
    padding: 10px 12px !important;
    color: var(--fpwc-cc-ink) !important;
    text-decoration: underline !important;
    text-underline-offset: 3px;
}

.fpwc-cc .fpwc-cc__btn--link:hover {
    background: var(--fpwc-cc-soft) !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc .fpwc-cc__btn:focus-visible,
.fpwc-cc-prefs .fpwc-cc__btn:focus-visible,
.fpwc-cc-prefs .fpwc-cc-prefs__close:focus-visible,
.fpwc-cc-reopen:focus-visible,
.fpwc-cc-prefs .fpwc-cc-switch__input:focus-visible + .fpwc-cc-switch__track {
    outline: 2px solid var(--fpwc-cc-accent, #00528a) !important;
    outline-offset: 2px !important;
}

/* ---------------------------------------------------- окно настроек */

.fpwc-cc-prefs .fpwc-cc__backdrop {
    z-index: 99991 !important;
}

.fpwc-cc-prefs__dialog {
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    z-index: 99992 !important;
    display: flex !important;
    flex-direction: column;
    width: min(540px, calc(100vw - 32px)) !important;
    max-height: calc(100vh - 48px);
    max-height: calc(100dvh - 48px);
    margin: 0 !important;
    padding: 0 !important;
    background: var(--fpwc-cc-bg) !important;
    color: var(--fpwc-cc-ink) !important;
    border: 1px solid var(--fpwc-cc-line) !important;
    border-radius: 16px !important;
    box-shadow: none !important;
    transform: translate(-50%, -50%);
    outline: none !important;
    animation: fpwc-cc-in-center .22s ease-out both;
}

.fpwc-cc-prefs__head {
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 24px 12px !important;
}

.fpwc-cc-prefs .fpwc-cc__title {
    font-size: 18px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc-prefs .fpwc-cc-prefs__close {
    -webkit-appearance: none !important;
    appearance: none !important;
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    flex: none;
    width: 36px !important;
    min-width: 0 !important;
    height: 36px !important;
    min-height: 0 !important;
    margin: 0 -8px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 8px !important;
    background: none !important;
    box-shadow: none !important;
    color: var(--fpwc-cc-muted) !important;
    cursor: pointer !important;
}

.fpwc-cc-prefs .fpwc-cc-prefs__close:hover {
    background: var(--fpwc-cc-soft) !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc-prefs__list {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto !important;
    overscroll-behavior: contain;
    padding: 0 24px !important;
}

.fpwc-cc-prefs__item {
    padding: 14px 0 !important;
    border-top: 1px solid var(--fpwc-cc-line) !important;
}

.fpwc-cc-prefs .fpwc-cc-prefs__desc {
    margin: 6px 0 0 !important;
    padding-right: 64px !important;
    font-size: 13.5px !important;
    line-height: 1.5 !important;
    color: var(--fpwc-cc-muted) !important;
}

.fpwc-cc-prefs__actions {
    display: flex !important;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    padding: 16px 24px 20px !important;
    border-top: 1px solid var(--fpwc-cc-line) !important;
}

/* Переключатель */
.fpwc-cc-prefs .fpwc-cc-switch {
    position: relative !important;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 15px !important;
    font-weight: 400 !important;
    cursor: pointer;
}

.fpwc-cc-switch__text {
    display: flex !important;
    flex-direction: column;
    min-width: 0;
}

.fpwc-cc-prefs .fpwc-cc-switch__label {
    font-size: 15px !important;
    font-weight: 600 !important;
    line-height: 1.35 !important;
    color: var(--fpwc-cc-ink) !important;
}

.fpwc-cc-prefs .fpwc-cc-switch__note {
    font-size: 12.5px !important;
    line-height: 1.4 !important;
    color: var(--fpwc-cc-muted) !important;
}

.fpwc-cc-prefs .fpwc-cc-switch__input {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: absolute !important;
    top: 50% !important;
    right: 0 !important;
    width: 44px !important;
    height: 26px !important;
    min-width: 0 !important;
    margin: -13px 0 0 !important;
    padding: 0 !important;
    border: 0 !important;
    background: none !important;
    box-shadow: none !important;
    opacity: 0 !important;
    cursor: pointer;
}

.fpwc-cc-prefs .fpwc-cc-switch__input::before,
.fpwc-cc-prefs .fpwc-cc-switch__input::after {
    display: none !important;
}

.fpwc-cc-switch__track {
    position: relative !important;
    display: block !important;
    flex: none;
    width: 44px !important;
    height: 26px !important;
    border-radius: 999px !important;
    background: var(--fpwc-cc-line) !important;
    pointer-events: none;
    transition: background-color .15s ease;
}

.fpwc-cc-switch__track::after {
    content: "" !important;
    position: absolute !important;
    top: 3px !important;
    left: 3px !important;
    width: 20px !important;
    height: 20px !important;
    border-radius: 50% !important;
    background: #ffffff !important;
    transition: transform .15s ease;
}

.fpwc-cc-switch__input:checked + .fpwc-cc-switch__track {
    background: var(--fpwc-cc-accent, #00528a) !important;
}

.fpwc-cc-switch__input:checked + .fpwc-cc-switch__track::after {
    transform: translateX(18px);
}

.fpwc-cc-switch__input:disabled + .fpwc-cc-switch__track {
    opacity: .55;
}

.fpwc-cc-switch:has(.fpwc-cc-switch__input:disabled) {
    cursor: default;
}

/* ------------------------------------------ кнопка «Настройки cookie» */

.fpwc-cc-reopen {
    -webkit-appearance: none !important;
    appearance: none !important;
    position: fixed !important;
    right: 20px !important;
    bottom: calc(20px + var(--fpwc-cc-offset, 0px)) !important;
    left: auto !important;
    top: auto !important;
    z-index: 9990 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 44px !important;
    min-width: 0 !important;
    height: 44px !important;
    min-height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    border: 1px solid var(--fpwc-cc-line) !important;
    border-radius: 50% !important;
    background: var(--fpwc-cc-bg) !important;
    box-shadow: none !important;
    color: var(--fpwc-cc-ink) !important;
    cursor: pointer !important;
}

.fpwc-cc-reopen:hover {
    background: var(--fpwc-cc-soft) !important;
}

/* ------------------------------------------------------------- анимация */

@keyframes fpwc-cc-in {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: none; }
}

@keyframes fpwc-cc-in-center {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 12px)); }
    to { opacity: 1; transform: translate(-50%, -50%); }
}

@keyframes fpwc-cc-in-sheet {
    from { opacity: 0; transform: translate(-50%, 16px); }
    to { opacity: 1; transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .fpwc-cc__banner,
    .fpwc-cc-prefs__dialog {
        animation: none !important;
    }

    .fpwc-cc .fpwc-cc__btn,
    .fpwc-cc-prefs .fpwc-cc__btn,
    .fpwc-cc-switch__track,
    .fpwc-cc-switch__track::after,
    html.fpwc-cc-pos-bar #smorya-floating-btn {
        transition: none !important;
    }
}

/* ------------------------------------------------------- адаптивность */

/* Планшеты: кнопки полосы переносятся под текст */
@media (max-width: 1024px) {
    .fpwc-cc--bar .fpwc-cc__inner {
        grid-template-columns: auto minmax(0, 1fr);
        grid-template-areas:
            "icon body"
            ". actions";
        gap: 14px 16px;
    }

    .fpwc-cc--bar .fpwc-cc__actions {
        justify-content: flex-start;
    }
}

/* Телефоны */
@media (max-width: 600px) {
    .fpwc-cc--bar .fpwc-cc__banner {
        padding: 14px 16px calc(14px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .fpwc-cc--bar .fpwc-cc__inner {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas:
            "body"
            "actions";
        gap: 12px;
    }

    .fpwc-cc--bar .fpwc-cc__icon {
        display: none !important;
    }

    /* Длинный текст прокручивается, кнопки всегда видны */
    .fpwc-cc--bar .fpwc-cc__body {
        max-height: 34vh;
        overflow-y: auto;
    }

    .fpwc-cc--bar .fpwc-cc__actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
    }

    .fpwc-cc--bar .fpwc-cc__btn--primary {
        grid-column: 1 / -1;
        order: -1;
    }

    .fpwc-cc--box-left .fpwc-cc__banner,
    .fpwc-cc--box-right .fpwc-cc__banner {
        left: 12px !important;
        right: 12px !important;
        bottom: calc(12px + var(--fpwc-cc-offset, 0px)) !important;
        width: auto !important;
        padding: 16px !important;
    }

    .fpwc-cc--modal .fpwc-cc__banner {
        padding: 20px !important;
    }

    .fpwc-cc .fpwc-cc__text {
        font-size: 13.5px !important;
    }

    /* Окно настроек — шторкой снизу */
    .fpwc-cc-prefs__dialog {
        top: auto !important;
        bottom: 0 !important;
        width: 100% !important;
        max-height: 88vh;
        max-height: 88dvh;
        border-radius: 16px 16px 0 0 !important;
        border-width: 1px 0 0 !important;
        transform: translateX(-50%);
        animation-name: fpwc-cc-in-sheet;
    }

    .fpwc-cc-prefs__head {
        padding: 16px 16px 10px !important;
    }

    .fpwc-cc-prefs__list {
        padding: 0 16px !important;
    }

    .fpwc-cc-prefs .fpwc-cc-prefs__desc {
        padding-right: 0 !important;
    }

    .fpwc-cc-prefs__actions {
        display: grid !important;
        grid-template-columns: 1fr 1fr;
        padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px)) !important;
    }

    .fpwc-cc-prefs__actions .fpwc-cc__btn--primary {
        grid-column: 1 / -1;
        order: -1;
    }

    .fpwc-cc-prefs__actions .fpwc-cc__btn:only-child {
        grid-column: 1 / -1;
    }

    .fpwc-cc-reopen {
        right: 12px !important;
        bottom: calc(12px + var(--fpwc-cc-offset, 0px)) !important;
    }
}

/* Совсем узкие экраны: все кнопки в столбик */
@media (max-width: 360px) {
    .fpwc-cc--bar .fpwc-cc__actions,
    .fpwc-cc--box-left .fpwc-cc__actions,
    .fpwc-cc--box-right .fpwc-cc__actions,
    .fpwc-cc--modal .fpwc-cc__actions,
    .fpwc-cc-prefs__actions {
        grid-template-columns: 1fr;
    }
}

/* Невысокие экраны (телефон боком) */
@media (max-height: 480px) {
    .fpwc-cc--bar .fpwc-cc__body {
        max-height: 30vh;
        overflow-y: auto;
    }
}

/* ---------------------------------------------- размеры иконок и подписи */

/* Темы иногда задают размер всем svg — фиксируем свои */
.fpwc-cc .fpwc-cc__icon svg {
    width: 24px !important;
    height: 24px !important;
}

.fpwc-cc-prefs .fpwc-cc-prefs__close svg {
    width: 20px !important;
    height: 20px !important;
}

.fpwc-cc-reopen svg {
    width: 22px !important;
    height: 22px !important;
}

/* Подписи переключателей — без заглавных букв и отступов из стилей темы для <label> */
.fpwc-cc-prefs .fpwc-cc-switch,
.fpwc-cc-prefs .fpwc-cc-switch * {
    text-transform: none !important;
    letter-spacing: normal !important;
}

.fpwc-cc-prefs .fpwc-cc-switch__text,
.fpwc-cc-prefs .fpwc-cc-switch__label,
.fpwc-cc-prefs .fpwc-cc-switch__note {
    margin: 0 !important;
    padding: 0 !important;
}
