/* =====================================================
   AGORA HEADER — основные стили
   Подключается через functions.php: agora_pro_scripts()
   ===================================================== */

:root {
    --header-height: 70px; /* высота шапки — используется для компенсации на не-hero страницах */
}

/* --- Reset top margin (тема/WP иногда добавляют отступ) --- */
html,
body {
    margin: 0 !important;
    padding: 0 !important;
}

/* --- Фон страницы: фиксированная картинка молока --- */
body {
    background-color: #0d1b2a;
    background-image: url('../images/milk-bg.png'); /* относительный путь из CSS-файла в папке темы */
    background-repeat: no-repeat;
    background-position: center center;
    background-size: cover;
    background-attachment: fixed;
}

#page,
.site,
.site-content,
.site-main,
.content-area,
main,
#primary {
    background-color: transparent !important;
    background: transparent !important;
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* --- Шапка: fixed — висит над всем контентом, hero уходит под неё --- */
.agora-header {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    overflow: visible;
    transition: box-shadow 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Главная страница: hero идёт под шапку (отступ не нужен) */
.home #primary,
.home .site-main {
    margin-top: 0 !important;
    padding-top: 0 !important;
}

/* Все остальные страницы: компенсируем высоту фиксированной шапки */
body:not(.home) #primary,
body:not(.home) .site-main {
    padding-top: var(--header-height) !important;
    margin-top: 0 !important;
}

/* --- Пружинная анимация шапки при pull/wheel-up --- */
@keyframes headerWobble {
    0%   { border-bottom-left-radius: 0;    border-bottom-right-radius: 0;    transform: scaleY(1)    translateY(0); }
    18%  { border-bottom-left-radius: 60px; border-bottom-right-radius: 60px; transform: scaleY(1.08) translateY(14px); }
    36%  { border-bottom-left-radius: 15px; border-bottom-right-radius: 15px; transform: scaleY(0.95) translateY(-8px); }
    52%  { border-bottom-left-radius: 40px; border-bottom-right-radius: 40px; transform: scaleY(1.04) translateY(6px); }
    67%  { border-bottom-left-radius: 8px;  border-bottom-right-radius: 8px;  transform: scaleY(0.98) translateY(-4px); }
    80%  { border-bottom-left-radius: 20px; border-bottom-right-radius: 20px; transform: scaleY(1.02) translateY(2px); }
    91%  { border-bottom-left-radius: 4px;  border-bottom-right-radius: 4px;  transform: scaleY(0.99) translateY(-1px); }
    100% { border-bottom-left-radius: 0;    border-bottom-right-radius: 0;    transform: scaleY(1)    translateY(0); }
}

.agora-header.is-wobbling {
    animation: headerWobble 1.1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

/* --- Внутренний ряд шапки --- */
.agora-header-single {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 0;
    font-size: 0.9rem;
    gap: 20px;
}

/* --- Логотип --- */
.agora-logo {
    flex-shrink: 0;
}

.agora-logo a {
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.agora-logo a:hover {
    transform: scale(1.05);
}

/* Логотип: плавное появление снизу с пружиной */
@keyframes logoEntrance {
    0%   { opacity: 0; transform: translateY(10px) scale(0.95); }
    65%  { opacity: 1; transform: translateY(-3px) scale(1.02); }
    100% { opacity: 1; transform: translateY(0)    scale(1); }
}

/* Логотип: парение на hover */
@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-4px); }
}

.agora-logo img {
    height: 60px !important;
    max-height: 60px !important;
    width: auto !important;
    max-width: none !important;
    object-fit: contain !important;
    margin: 0 !important;
    animation: logoEntrance 0.6s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Убираем hover через animation — достаточно scale на a */
.agora-logo a:hover img {
    filter: drop-shadow(0 4px 12px rgba(59, 130, 246, 0.2));
}

/* --- Навигация --- */
.agora-custom-nav {
    display: flex;
    gap: 4px;
    font-weight: 700;
    font-size: 0.95rem;
    align-items: center;
    position: relative;
}

/* Скользящая таблетка-фон */
#nav-pill {
    position: absolute;
    height: 100%;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.08);
    pointer-events: none;
    top: 0;
    left: 0;
    width: 0;
    z-index: 0;
    opacity: 0;
    transition:
        left   0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
        width  0.45s cubic-bezier(0.34, 1.56, 0.64, 1),
        opacity 0.3s ease;
}

.agora-custom-nav .nav-item {
    padding: 10px 18px;
    border-radius: 10px;
    color: var(--color-navy, #1e3a5f);
    text-decoration: none;
    position: relative;
    z-index: 1;
    font-weight: 700;
    opacity: 0.65;
    transition: all 0.3s ease;
}

.agora-custom-nav .nav-item:not(.is-active):hover {
    opacity: 1;
    color: #3B82F6;
    transform: translateY(-1px);
}

.agora-custom-nav .nav-item.is-active:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.agora-custom-nav .nav-item.is-active {
    opacity: 1;
    font-weight: 800;
}

/* Двухцветная черта под активным пунктом */
.nav-underline {
    position: absolute;
    bottom: 0;
    left: 15%;
    width: 70%;
    height: 3px;
    display: flex;
    border-radius: 3px;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.nav-underline.is-visible {
    opacity: 1;
}

.nav-underline span:first-child  { background: #3B82F6; width: 50%; height: 100%; }
.nav-underline span:last-child   { background: var(--color-wild-orange, #f97316); width: 50%; height: 100%; }

/* --- Значки сертификатов --- */
.header-badges {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* Значки: появление снизу */
@keyframes badgeFadeUp {
    0%   { opacity: 0; transform: translateY(14px) scale(0.85); }
    70%  { opacity: 1; transform: translateY(-2px) scale(1.03); }
    100% { opacity: 1; } /* transform не фиксируем — иначе hover не сработает */
}

.header-badges img {
    height: 44px;
    width: 44px;
    object-fit: contain;
    opacity: 0;
    animation: badgeFadeUp 0.55s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
    transition: transform 0.4s ease-out, filter 0.4s ease;
}

.header-badges img:nth-child(1) { animation-delay: 0.10s; }
.header-badges img:nth-child(2) { animation-delay: 0.22s; }
.header-badges img:nth-child(3) { animation-delay: 0.34s; }

.header-badges img.badge-rst {
    height: 52px;
    width: 52px;
}

.header-badges img:hover {
    transform: scale(1.08) rotate(3deg);
    filter: drop-shadow(0 3px 6px rgba(0, 0, 0, 0.12));
}


/* --- Контактный блок --- */
.header-contact-block {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-shrink: 0;
}

.header-phone-link {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 800;
    color: var(--color-navy, #1e3a5f);
    text-decoration: none;
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.header-phone-link:hover {
    color: #3B82F6;
    transform: translateX(-2px);
}

.header-phone-icon {
    background: rgba(59, 130, 246, 0.1);
    padding: 8px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.header-phone-link:hover .header-phone-icon {
    background: rgba(59, 130, 246, 0.2);
    transform: scale(1.1);
}

.header-cta-btn {
    background-color: #6CBAD1;
    color: #fff;
    padding: 12px 24px;
    border-radius: 24px;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    transition: background-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    box-shadow: 0 4px 10px rgba(108, 186, 209, 0.3);
    white-space: nowrap;
    display: inline-block;
}

.header-cta-btn:hover {
    background-color: #5BA5BC;
    transform: translateY(-2px);
    box-shadow: 0 6px 15px rgba(108, 186, 209, 0.4);
}

/* --- Кнопка поиска --- */
#search-open-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #f0f4f8;
    cursor: pointer;
    transition: all 0.3s ease;
    border: none;
    flex-shrink: 0;
}

#search-open-btn:hover {
    background: #e2e8f0;
    transform: scale(1.08);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

#search-open-btn svg {
    transition: transform 0.3s ease;
}

#search-open-btn:hover svg {
    transform: scale(1.1);
}

/* --- Строка поиска (скрыта по умолчанию) --- */
#header-search-bar {
    display: none;
    align-items: center;
    padding: 6px 0;
    gap: 15px;
    opacity: 0;
    transition: opacity 0.2s ease-in-out;
}

.header-search-form {
    display: flex;
    flex: 1;
    align-items: center;
    background: #f0f4f8;
    border-radius: 12px;
    padding: 0 16px;
    gap: 12px;
    height: 60px;
    box-sizing: border-box;
}

#header-search-input {
    flex: 1;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.1rem;
    padding: 0;
    height: 100%;
    color: var(--color-navy, #1e3a5f);
    font-family: inherit;
}

#search-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: #f0f4f8;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

#search-close-btn:hover { background: #e2e8f0; }

/* --- Тень при прокрутке (добавляется через JS) --- */
.agora-header.is-scrolled {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

/* =====================================================
   BADGE POPUP — всплывающая карточка сертификата
   ===================================================== */

/* Keyframe: выезд вниз из-под шапки */
@keyframes popupSlideDown {
    0%   { opacity: 0; transform: translateY(-10px) scaleY(0.92); }
    65%  { opacity: 1; transform: translateY(2px)   scaleY(1.01); }
    100% { opacity: 1; transform: translateY(0)     scaleY(1); }
}

@keyframes popupSlideUp {
    0%   { opacity: 1; transform: translateY(0); }
    100% { opacity: 0; transform: translateY(-8px); }
}

.badge-popup {
    position: absolute;
    top: 100%;          /* прямо под шапкой */
    left: 50%;
    transform: translateX(-50%) translateY(-6px);
    z-index: 999;
    width: max-content;
    max-width: 420px;
    min-width: 280px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.25s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.badge-popup.is-open {
    pointer-events: all;
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    animation: popupSlideDown 0.38s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

/* Стрелочка сверху — SMS-пузырёк */
.badge-popup__arrow {
    width: 18px;
    height: 10px;
    position: absolute;
    top: -10px;
    left: 50%;
    transform: translateX(-50%);
    overflow: hidden;
}

.badge-popup__arrow::after {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    background: #ffffff;
    border-top: 2px solid #3B82F6;
    border-left: 2px solid #3B82F6;
    top: 4px;
    left: 2px;
    transform: rotate(45deg);
}

/* Внешняя обёртка с градиентной рамкой синий→оранжевый */
.badge-popup__inner {
    background: #ffffff;
    border-radius: 16px;
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    position: relative;

    /* Градиентная рамка через outline trick */
    border: 2px solid transparent;
    background-clip: padding-box;
    box-shadow:
        0 8px 32px rgba(0, 0, 0, 0.12),
        0 0 0 2px transparent;

    /* Имитация градиентной рамки через псевдоэлемент */
}

.badge-popup__inner::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 18px;
    background: linear-gradient(90deg, #3B82F6, #f97316);
    z-index: -1;
}

/* Иконка */
.badge-popup__icon-wrap {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(59,130,246,0.08), rgba(249,115,22,0.06));
    border-radius: 12px;
}

.badge-popup__icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
}

/* Текст */
.badge-popup__text {
    flex: 1;
}

.badge-popup__title {
    font-weight: 800;
    font-size: 0.92rem;
    color: #1e3a5f;
    margin: 0 0 4px 0;
    letter-spacing: -0.01em;
}

.badge-popup__desc {
    font-size: 0.8rem;
    color: #64748b;
    margin: 0;
    line-height: 1.5;
}

/* Кнопка закрытия */
.badge-popup__close {
    flex-shrink: 0;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: none;
    background: #f1f5f9;
    color: #94a3b8;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: flex-start;
    transition: background 0.2s ease, color 0.2s ease;
}

.badge-popup__close:hover {
    background: #e2e8f0;
    color: #475569;
}

/* Значки — курсор pointer */
.header-badges img[data-badge] {
    cursor: pointer;
}

/* Активный значок — лёгкая подсветка */
.header-badges img[data-badge].is-active-badge {
    filter: drop-shadow(0 0 8px rgba(59, 130, 246, 0.45));
    transform: scale(1.1);
}
