
/* =====================================
   BLACK FRIDAY — AUTO PREMIUM
   ===================================== */

.ap-bf-overlay,
.ap-bf-overlay *,
.ap-bf-widget {
    box-sizing: border-box;
}

.ap-bf-overlay[hidden],
.ap-bf-widget[hidden] {
    display: none !important;
}

/* Затемнение страницы */

.ap-bf-overlay {
    position: fixed;
    inset: 0;
    z-index: 99998;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.65);
    padding: 0;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.ap-bf-overlay.ap-bf-visible {
    opacity: 1;
}

/* Основной баннер */

.ap-bf-modal {
    position: relative;
    width: 90%;
    max-height: calc(100vh - 32px);
    max-height: calc(100dvh - 32px);
    overflow: auto;
    container-type: inline-size;

    background: linear-gradient(
        145deg,
        #22252d 0%,
        #17191f 45%,
        #101115 100%
    );

    border: 1px solid #ff762e;
    border-radius: 12px;

    box-shadow:
        0 0 12px rgba(255, 100, 20, 0.18),
        0 0 40px rgba(255, 80, 0, 0.12),
        inset 0 0 20px rgba(255, 100, 20, 0.04);

    color: #ffffff;
    text-align: center;
    font-family: inherit;

    transform: scale(0.92);
    transition: transform 0.3s ease;
}

.ap-bf-visible .ap-bf-modal {
    transform: scale(1);
}

/* Светящийся участок верхней рамки */

.ap-bf-modal::before {
    content: "";
    position: absolute;
    top: 0;
    left: 32%;
    width: 36%;
    height: 3px;
    border-radius: 0 0 4px 4px;
    background: #ff782e;

    box-shadow:
        0 0 8px #ff681e,
        0 0 18px rgba(255, 100, 20, 0.8),
        0 0 30px rgba(255, 100, 20, 0.4);

    pointer-events: none;
}

/* Ссылка на всю площадь баннера */

.ap-bf-link,
.ap-bf-link:hover,
.ap-bf-link:visited,
.ap-bf-link:active {
    display: block;
    padding: 30px 18px 22px;
    padding: 9cqw 5cqw 6cqw;
    color: #ffffff;
    text-decoration: none;
}

/* Кнопка закрытия */

.ap-bf-close {
    position: absolute;
    z-index: 2;
    top: 5px;
    right: 5px;

    display: flex;
    align-items: center;
    justify-content: center;

    width: 36px;
    height: 36px;
    padding: 0;
    border: none;
    border-radius: 50%;

    background: transparent;
    color: #a5a6ac;

    font-family: Arial, sans-serif;
    font-size: 30px;
    font-weight: 300;
    line-height: 1;

    cursor: pointer;
    transition: color 0.2s, background 0.2s;
}

.ap-bf-close:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.08);
}

/* Название компании */

.ap-bf-brand {
    color: #b9bbc4;
    font-size: 11px;
    font-size: clamp(9px, 3cqw, 16px);
    font-weight: 400;
    letter-spacing: 0.24em;
    line-height: 1.5;
    margin-bottom: 14px;
}

/* Заголовок */

.ap-bf-title {
    color: #ffffff;
    font-size: 36px;
    font-size: clamp(27px, 10cqw, 76px);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: 0.025em;
    margin-bottom: 12px;

    text-shadow: 0 3px 8px rgba(0, 0, 0, 0.4);
}

/* Размер скидки */

.ap-bf-discount {
    color: #ff681e;
    font-size: 86px;
    font-size: clamp(64px, 25cqw, 180px);
    font-weight: 900;
    line-height: 1.05;
    letter-spacing: -0.035em;
    white-space: nowrap;
    margin: 10px 0;

    text-shadow:
        0 0 10px rgba(255, 100, 20, 0.35),
        0 0 25px rgba(255, 100, 20, 0.3);
}

.ap-bf-discount span {
    font-size: 0.62em;
}

/* На услуги СТО */

.ap-bf-service {
    font-size: 21px;
    font-size: clamp(17px, 6cqw, 34px);
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 10px;
}

/* Условие получения скидки */

.ap-bf-description {
    color: #b0b2bb;
    font-size: 13px;
    font-size: clamp(12px, 3.6cqw, 21px);
    font-weight: 400;
    line-height: 1.45;
}

/* Условия предложения */

.ap-bf-terms {
    position: relative;
    margin-top: 18px;
    padding-top: 15px;
    color: #a2a4ad;
    font-size: 11px;
    font-size: clamp(11px, 3cqw, 16px);
    font-weight: 400;
    line-height: 1.5;
}

.ap-bf-terms::before {
    content: "";
    position: absolute;
    top: 0;
    left: 5%;
    width: 90%;
    height: 1px;

    background: linear-gradient(
        90deg,
        transparent,
        rgba(255, 104, 30, 0.5),
        transparent
    );

    box-shadow: 0 0 8px rgba(255, 104, 30, 0.25);
}

.ap-bf-terms p {
    margin: 0 0 5px;
}

.ap-bf-terms p:last-child {
    margin-bottom: 0;
}

/* =====================================
   АДАПТИВНОСТЬ
   ===================================== */

/* От 768 до 1280 px:
   плавное изменение ширины с 50% до 20% */

@media (min-width: 768px) {
    .ap-bf-modal {
        width: max(
            320px,
            calc(95vw - 0.05859375 * 100vw * 100vw / 1px)
        );
        /* Совместимый вариант для браузеров */
        width: clamp(320px, calc(576px - 25vw), 50vw);
    }
}

/* От 1280 px */

@media (min-width: 1280px) {
    .ap-bf-modal {
        width: 20%;
        min-width: 320px;
        max-width: 650px;
    }
}

/* Небольшие мобильные экраны */

@media (max-width: 380px) {
    .ap-bf-brand {
        letter-spacing: 0.16em;
    }

    .ap-bf-close {
        top: 2px;
        right: 2px;
        font-size: 26px;
    }
}

/* =====================================
   СВЁРНУТЫЙ ВИДЖЕТ
   ===================================== */

.ap-bf-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 99997;

    display: block;
    padding: 15px 22px;

    background: linear-gradient(
        145deg,
        #252830,
        #101115
    );

    border: 1px solid #ff762e;
    border-radius: 8px;

    color: #ffffff;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.3;

    box-shadow:
        0 0 12px rgba(255, 100, 20, 0.3),
        0 4px 15px rgba(0, 0, 0, 0.2);

    cursor: pointer;
    transform-origin: center bottom;

    animation: ap-bf-wiggle 5s ease-in-out infinite;
}

.ap-bf-widget:hover {
    animation-play-state: paused;
    border-color: #ffa15f;
    box-shadow: 0 0 20px rgba(255, 100, 20, 0.5);
}

/* Покачивание с паузой между циклами */

@keyframes ap-bf-wiggle {
    0%, 72%, 100% {
        transform: rotate(0deg);
    }

    76%, 88% {
        transform: rotate(-6deg);
    }

    82%, 94% {
        transform: rotate(6deg);
    }
}

/* Виджет на мобильных устройствах */

@media (max-width: 767px) {
    .ap-bf-widget {
        right: 15px;
        bottom: 15px;
        bottom: calc(15px + env(safe-area-inset-bottom, 0px));
        padding: 12px 16px;
        font-size: 14px;
    }
}

/* Управление с клавиатуры */

.ap-bf-close:focus-visible,
.ap-bf-link:focus-visible,
.ap-bf-widget:focus-visible {
    outline: 2px solid #ff9b59;
    outline-offset: -3px;
}

/* Для пользователей, отключивших анимацию */

@media (prefers-reduced-motion: reduce) {
    .ap-bf-widget {
        animation: none;
    }

    .ap-bf-overlay,
    .ap-bf-modal {
        transition: none;
    }
}
#ap-bf-widget .ap-bf-widget-discount {
    color: #ff681e !important;
    font-weight: 900;
    font-size: 24px;
    text-shadow: 0 0 10px rgba(255, 104, 30, 0.5);
}

@media (max-width: 767px) {
    #ap-bf-widget .ap-bf-widget-discount {
        font-size: 21px;
    }
}