/* Новости на сайте (ST-1706): страница /news, окно новости, оповещение и счётчик у «Еще». */

/* ---------- Страница ---------- */

.news-page {
    background: linear-gradient(180deg, #d9cdfb 0%, #ede7fd 320px, #f7f5fe 640px, #fff 100%);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

.news-hero {
    padding: 132px 24px 28px;
    text-align: center;
}

.news-hero__title {
    margin: 0 auto;
    max-width: 640px;
    font-size: 44px;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.02em;
    background: linear-gradient(105deg, #5b2ee6 0%, #8752fa 60%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* Одна строка на десктопе; на телефоне переносится сама (см. медиазапрос ниже). */
.news-hero__subtitle {
    margin: 12px auto 0;
    white-space: nowrap;
    font-size: 16px;
    line-height: 1.45;
    color: #55536a;
}

.news-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 24px 96px;
}

.news-empty {
    max-width: 1240px;
    margin: 0 auto;
    padding: 24px 24px 120px;
    text-align: center;
    color: #55536a;
}

/* ---------- Карточка ---------- */

.news-card {
    display: flex;
    flex-direction: column;
    padding: 10px 10px 22px;
    border-radius: 26px;
    background: #fff;
    box-shadow: 0 10px 30px rgba(92, 64, 190, 0.08);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.news-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 14px 34px rgba(92, 64, 190, 0.14);
}

.news-card__title {
    margin: 22px 14px 0;
    font-size: 17px;
    font-weight: 700;
    line-height: 1.3;
    color: #17162a;
}

.news-card__summary {
    margin: 10px 14px 20px;
    font-size: 14px;
    line-height: 1.5;
    color: #55536a;
}

/* Кнопка всегда внизу слева: карточки в ряду одной высоты, а текст у них разной длины. */
.news-card__more {
    align-self: flex-start;
    margin: auto 14px 0;
    padding: 11px 24px;
    border-radius: 12px;
    background: linear-gradient(105deg, #7137f9 0%, #8752fa 60%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
}

.news-card__more:hover {
    color: #fff;
    filter: brightness(1.06);
}

/* Цветная плашка с эмодзи: фон из CRM, поверх — светлый перелив и два круга, как в макете. */
.news-tile {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 126px;
    border-radius: 18px;
    overflow: hidden;
    background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.55) 0%, rgba(255, 255, 255, 0) 65%);
}

.news-tile::before,
.news-tile::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.45);
}

.news-tile::before {
    width: 160px;
    height: 160px;
    top: -70px;
    right: -40px;
}

.news-tile::after {
    width: 90px;
    height: 90px;
    bottom: -50px;
    left: -20px;
}

.news-tile__emoji {
    position: relative;
    z-index: 1;
    font-size: 56px;
    line-height: 1;
}

.news-new-badge {
    position: absolute;
    z-index: 2;
    top: 12px;
    left: 12px;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #fff;
    color: #6b3df0;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
    box-shadow: 0 2px 6px rgba(92, 64, 190, 0.12);
}

.news-new-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #ef4444;
}

/* ---------- Окно новости ---------- */

.news-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

.news-modal[hidden] {
    display: none;
}

.news-modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(58, 45, 120, 0.55);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.news-modal__panel {
    position: relative;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 566px;
    max-height: calc(100vh - 48px);
    border-radius: 24px;
    overflow: hidden;
    background: #fff;
    box-shadow: 0 24px 60px rgba(30, 20, 80, 0.3);
}

.news-modal__panel .news-tile {
    flex: 0 0 auto;
    height: 150px;
    border-radius: 0;
}

.news-modal__close {
    position: absolute;
    z-index: 3;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 50%;
    background: #fff;
    color: #17162a;
    box-shadow: 0 2px 8px rgba(30, 20, 80, 0.15);
    cursor: pointer;
}

.news-modal__content {
    overflow-y: auto;
    padding: 28px 30px 32px;
}

.news-modal__title {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
    line-height: 1.25;
    color: #17162a;
}

.news-modal__body {
    margin-top: 16px;
    font-size: 15px;
    line-height: 1.6;
    color: #2e2c40;
    overflow-wrap: anywhere;
}

.news-modal__body p,
.news-modal__body div {
    margin: 0 0 12px;
}

.news-modal__body ul,
.news-modal__body ol {
    margin: 0 0 12px;
    padding-left: 22px;
}

.news-modal__body ul {
    list-style: disc;
}

.news-modal__body ol {
    list-style: decimal;
}

.news-modal__body a {
    color: #6b3df0;
    text-decoration: underline;
}

.news-modal__body b,
.news-modal__body strong {
    font-weight: 700;
}

body.news-modal-open {
    overflow: hidden;
}

/* ---------- Счётчик у «Еще» ---------- */

.news-unread[hidden] {
    display: none;
}

/* Число: в пункте «Новости» и рядом с «Еще». */
.news-unread--count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #8752fa;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
}

/* Зелёный кружок у «Еще»: «там что-то новое». */
.news-unread--dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 2px #fff;
}

.news-menu-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

/* ---------- Оповещение справа внизу ---------- */

.news-popup {
    position: fixed;
    z-index: 900;
    right: 24px;
    bottom: 24px;
    width: 360px;
    max-width: calc(100vw - 32px);
    padding: 16px;
    border: 2px solid #8752fa;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 16px 40px rgba(92, 64, 190, 0.22);
    font-family: 'Inter', ui-sans-serif, system-ui, sans-serif;
}

.news-popup[hidden] {
    display: none;
}

/* Анимация как в макете (видео к ST-1706): карточка выезжает снизу, потом каждые ~3 с
   колокольчик «звенит», а вокруг карточки расходится фиолетовый ореол. */
.news-popup:not([hidden]) {
    animation: news-popup-enter 0.45s cubic-bezier(0.2, 0.9, 0.3, 1.2) both,
        news-popup-halo 3s ease-out 0.6s infinite;
}

.news-popup:not([hidden]) .news-popup__icon {
    animation: news-popup-ring 3s ease-in-out 0.6s infinite;
    transform-origin: 50% 20%;
}

.news-popup:not([hidden]) .news-popup__new::before {
    animation: news-popup-blink 1.5s ease-in-out infinite;
}

@keyframes news-popup-enter {
    from {
        opacity: 0;
        transform: translateY(24px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes news-popup-halo {
    0% {
        box-shadow: 0 16px 40px rgba(92, 64, 190, 0.22), 0 0 0 0 rgba(135, 82, 250, 0.35);
    }
    45% {
        box-shadow: 0 16px 40px rgba(92, 64, 190, 0.22), 0 0 0 12px rgba(135, 82, 250, 0);
    }
    100% {
        box-shadow: 0 16px 40px rgba(92, 64, 190, 0.22), 0 0 0 0 rgba(135, 82, 250, 0);
    }
}

/* Звон — в первой трети цикла, дальше колокольчик спокоен. */
@keyframes news-popup-ring {
    0%, 30%, 100% {
        transform: rotate(0);
    }
    5% {
        transform: rotate(-14deg);
    }
    10% {
        transform: rotate(12deg);
    }
    15% {
        transform: rotate(-9deg);
    }
    20% {
        transform: rotate(6deg);
    }
    25% {
        transform: rotate(-3deg);
    }
}

@keyframes news-popup-blink {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.3;
    }
}

@media (prefers-reduced-motion: reduce) {
    .news-popup:not([hidden]),
    .news-popup:not([hidden]) .news-popup__icon,
    .news-popup:not([hidden]) .news-popup__new::before {
        animation: none;
    }
}

.news-popup__row {
    display: flex;
    gap: 12px;
    padding-right: 22px;
}

.news-popup__icon {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #8752fa;
    font-size: 20px;
}

.news-popup__new {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    border-radius: 6px;
    background: #fde2e2;
    color: #e5484d;
    font-size: 11px;
    font-weight: 700;
}

.news-popup__new::before {
    content: '';
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #e5484d;
}

.news-popup__caption {
    margin-top: 4px;
    font-size: 13px;
    color: #8a8899;
}

.news-popup__title {
    margin-top: 2px;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    color: #17162a;
}

.news-popup__more {
    display: block;
    margin-top: 14px;
    padding: 11px 16px;
    border-radius: 12px;
    background: linear-gradient(105deg, #7137f9 0%, #8752fa 60%);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    text-align: center;
    text-decoration: none;
}

.news-popup__more:hover {
    color: #fff;
    filter: brightness(1.06);
}

.news-popup__close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: #8a8899;
    cursor: pointer;
}

.news-popup__close:hover {
    background: #f1edfe;
    color: #17162a;
}

/* ---------- Мобильная ширина ---------- */

@media (max-width: 1023px) {
    .news-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 639px) {
    .news-hero {
        padding: 112px 16px 28px;
    }

    .news-hero__title {
        font-size: 30px;
    }

    .news-hero__subtitle {
        font-size: 15px;
        white-space: normal;
    }

    .news-grid {
        grid-template-columns: minmax(0, 1fr);
        gap: 16px;
        padding: 0 16px 64px;
    }

    .news-modal {
        align-items: flex-end;
        padding: 0;
    }

    .news-modal__panel {
        max-width: none;
        max-height: 92vh;
        border-radius: 24px 24px 0 0;
    }

    .news-modal__content {
        padding: 22px 20px 28px;
    }

    .news-modal__title {
        font-size: 20px;
    }

    .news-popup {
        right: 16px;
        left: 16px;
        bottom: 16px;
        width: auto;
        max-width: none;
    }
}
