/* layout.css — только структура: хедер, навигация, футер, модалка */

/* Ссылки внутри хедера — единый стиль */
.header a,
.header__menu li a,
.auth-block a {
    color: #fff;
    text-decoration: none;
}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    z-index: 1000;
    height: 70px;
    background-color: #48036F;
    padding: 15px;
    display: flex;
    align-items: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: top 0.3s;
}

.header__container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    gap: 24px;
}

/* Логотип */
.logo-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 20px;
}

.logo {
    max-height: 70px;
    width: auto;
}

/* Текст логотипа: на мобильных — по центру хедера (логотип-картинка остаётся слева) */
@media (max-width: 1100px) {
    .logo-text {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
        color: #fff;
        text-decoration: none;
        font-weight: 700;
        font-size: 1.1rem;
        white-space: nowrap;  /* текст не переносится и не ломает центр */
        pointer-events: none; /* клик по центру не перехватывается текстом */
    }
}

/* На десктопе текст логотипа скрыт */
@media (min-width: 1101px) {
    .logo-text {
        display: none;
    }
}

/* Бургер */
.menu-burger__header {
    width: 35px;
    height: 35px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
}

.burger-line {
    height: 3px;
    width: 24px;
    background: #fff;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    transition: opacity 0.5s ease;
}

.menu-burger__header::before,
.menu-burger__header::after {
    content: '';
    position: absolute;
    height: 3px;
    width: 24px;
    background: #fff;
    transition: transform 0.4s ease;
}

.menu-burger__header::before {
    top: calc(50% - 6px);
    transform: translateY(-50%);
}

.menu-burger__header::after {
    bottom: calc(50% - 6px);
    transform: translateY(50%);
}

.menu-burger__header.open-menu .burger-line {
    opacity: 0;
}

.menu-burger__header.open-menu::before {
    transform: translateY(-50%) rotate(45deg);
}

.menu-burger__header.open-menu::after {
    transform: translateY(50%) rotate(-45deg);
}

/* Мобильное меню — выезжающая панель */
.header__nav {
    position: fixed;
    top: 70px;
    right: 0;
    width: 280px;
    height: auto;                      /* панель по высоте содержимого */
    max-height: calc(100vh - 70px);    /* но не длиннее экрана */
    overflow-y: auto;                  /* при переполнении — прокрутка */
    background-color: #e0e0e0;
    color: #1a1a1a;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    z-index: 999;
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.header__nav.open-menu {
    transform: translateX(0);
}

.header__menu {
    list-style: none;
    margin: 0;
    padding: 20px 0;
}

.header__menu li {
    margin: 0;
}

/* Ссылки в мобильном меню: тёмный текст, по левому краю */
@media (max-width: 1100px) {
    .header__menu li a {
        display: block;
        color: #1a1a1a;
        text-decoration: none;
        font-weight: 500;
        padding: 14px 20px;
        transition: background-color 0.2s ease;
        text-align: left;
    }

    .header__menu li a:hover,
    .header__menu li a.active {
        background-color: rgba(0, 0, 0, 0.08);
    }
}

/* В мобильном меню иконки скрыты — остаётся только текст ссылки */
.header__menu li a svg {
    display: none;
}

/* Текстовые подписи пунктов (menu-text): на мобильных видны */
.header__menu li a .menu-text {
    display: inline;
}

/* Тултипы */
.tooltip-item {
    position: relative;
}

.tooltip {
    position: absolute;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    background: #48036F;
    color: #fff;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    pointer-events: none;
    z-index: 10;
}

.tooltip-item:hover .tooltip {
    opacity: 1;
    visibility: visible;
}

/* Блок авторизации */
.auth-block {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-left: 20px;
}

.auth-block p,
.auth-block a {
    color: #fff;
    padding: 5px 10px;
    text-decoration: none;
}

.auth-block.authorized {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.auth-block.authorized p,
.auth-block.authorized a {
    font-size: 0.9em;
    transition: font-size 0.3s ease;
}

.auth-block a:hover {
    color: #4CAF50;
    text-decoration: none;
}

/* Десктоп: горизонтальное меню + авторизация справа */
@media (min-width: 1101px) {
    .menu-burger__header {
        display: none;
    }

    .header__nav {
        position: static;
        display: flex;
        gap: 16px;
        flex: 1 1 auto;
        width: auto;
        height: auto;            /* отменяем мобильную высоту */
        max-height: none;        /* отменяем ограничение по экрану */
        overflow: visible;       /* отменяем прокрутку панели */
        transform: none;         /* ГЛАВНОЕ: отменяем сдвиг translateX(100%) */
        background: transparent; /* отменяем серый фон мобильной панели */
        box-shadow: none;        /* отменяем тень мобильной панели */
        padding: 0;
        margin: 0;
        color: #fff;
    }

    .header__nav.open-menu {
        transform: none; /* на десктопе класс open-menu ничего не сдвигает */
    }

    .header__menu {
        display: flex;
        list-style: none;
        margin: 0;
        padding: 0;
        align-items: center;
    }

    .header__menu li {
        margin: 0 1px;
        padding: 0;
        position: relative;
    }

    .header__menu li a {
        color: #fff;
        text-decoration: none;
        font-weight: bold;
        padding: 5px 10px;
        font-size: 16.5px;
        line-height: 1;
        white-space: nowrap;
        transition: color 0.2s ease;
    }

    .header__menu li a:hover {
        color: #4CAF50 !important;
    }

    .header__menu li a svg {
        margin-right: 8px;
        display: inline-block; /* на десктопе иконки видны */
    }

    /* Подписи на десктопе не нужны — работают иконки с тултипами */
    .header__menu li a .menu-text {
        display: none;
    }

    /* Выносим auth-block вправо, в ряд с меню */
    .auth-block {
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: flex-start;
        gap: 12px;
        padding-left: 0;
    }
}

/* Планшеты и мобильные: бургер-навигация */
@media (max-width: 1100px) {
    /* Визуальное отделение блока авторизации в мобильном меню */
    .auth-block {
        border-top: 1px solid rgba(255, 255, 255, 0.15);
        margin-top: 10px;
        padding-top: 14px;
    }
}

/* Компактнее на узких экранах */
@media (max-width: 850px) {
    .auth-block.authorized p,
    .auth-block.authorized a {
        font-size: 0.9em;
    }

    .auth-block.authorized {
        gap: 5px;
    }
}

/* Адаптив для пунктов меню на планшетах */
@media (max-width: 768px) {
    .header__menu li {
        margin: 0;
        padding: 0;
    }

    .header__menu li a {
        display: block;
        text-align: center;
        padding: 12px 0;
    }
}

@media (max-width: 485px) {
    .logo {
        display: none;
    }

    .header__menu li a {
        font-size: 16px;
    }
}


/* Ограничиваем приветствие, чтобы длинный ник не ломал хедер */
.auth-block.authorized span:first-child {
    max-width: 140px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* --- Модалка авторизации: оверлей + содержимое --- */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 2000; /* выше хедера (у него 1000) */
    display: none;
    justify-content: center;
    align-items: center;
}

.auth-modal-overlay.active {
    display: flex;
}

.auth-modal-content {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    text-align: center;
    position: relative;
}

.auth-modal-close {
    position: absolute;
    top: 12px;
    right: 16px;
    font-size: 1.5rem;
    cursor: pointer;
    color: #666;
    line-height: 1;
}

.auth-modal-close:hover {
    color: #000;
}

.auth-modal-img {
    max-width: 100px;
    height: auto;
    margin-bottom: 1rem;
    display: block;
    margin-left: auto;
    margin-right: auto;
}

.auth-modal-title {
    margin: 0 0 1rem 0;
    font-size: 1.6rem;
}

.auth-modal-desc {
    color: #555;
    margin-bottom: 1.5rem;
    line-height: 1.4;
}

.auth-btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 1rem;
}

.auth-btn {
    display: block;
    padding: 0.8rem 1.2rem;
    font-size: 1rem;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    color: #fff;
    background-color: #0073e6;
    transition: background-color 0.2s;
}

.auth-btn:hover {
    background-color: #005bb5;
}

.auth-btn.auth-secondary {
    background-color: #f5f5f5;
    color: #333;
    border: 1px solid #ccc;
}

.auth-btn.auth-secondary:hover {
    background-color: #e0e0e0;
}

/* --- Футер: базовая версия (десктоп) --- */
footer {
    background-color: #48036F;
    color: #fff;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0;
}

.footer-content {
    text-align: center;
    width: 100%;
    max-width: 800px;
}

footer p {
    margin: 0;
    padding: 5px 0;
}

footer a {
    color: #fff;
    text-decoration: none;
}

footer a:hover {
    color: #ccc;
}

/* Telegram-блок в футере */
.telegram-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-top: 10px;
    width: 100%;
}

.telegram-link {
    margin-left: 8px;
}

.telegram-link img {
    transition: transform 0.3s;
    height: 24px;
    width: auto;
}

.telegram-link img:hover {
    transform: scale(1.1);
}

/* Ссылки в футере: по умолчанию — в ряд, но с переносом */
.footer-links {
    margin-top: 15px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
}

.footer-links a {
    color: #FFFFFF;
    text-decoration: none;
    font-size: 14px;
}

.footer-links a:hover {
    text-decoration: underline;
    color: #4CAF50;
}

@media (max-width: 1100px) {
    footer {
        flex-direction: column;
    }

    .footer-content {
        padding: 10px;
    }

    .telegram-container {
        justify-content: center;
    }

    .footer-links a {
        display: block;
        margin: 5px 0;
    }
}

@media only screen and (max-width: 470px) {
    footer {
        padding: 16px 12px;
    }

    .footer-content {
        width: 100%;
        max-width: 100%;
    }

    .footer-links {
        flex-direction: column;
        align-items: center;
        gap: 12px;
    }

    .footer-links a {
        display: block;
        width: 100%;
        text-align: center;
        padding: 8px 0;
        box-sizing: border-box;
    }

    .footer-links a:hover {
        background-color: rgba(255, 255, 255, 0.12);
        color: #4CAF50;
        text-decoration: none;
    }

    .telegram-container {
        width: 100%;
        justify-content: center;
        margin-top: 12px;
    }
}
