/* === СОВРЕМЕННЫЕ СТИЛИ ПОДВАЛА === */

/* Основные стили подвала */
footer {
    background: url('../img/webp/Background_Footer.webp') center/cover;
    background-color: #E8E8E8;
    color: var(--color-text-primary);
    margin-top: auto;
    position: relative;
    overflow: hidden;
    border-radius: 30px 30px 0 0;
}

/* Основной контент подвала */
.footer-content {
    padding: 3rem 0;
    position: relative;
    z-index: 2;
}

.footer-sections {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.footer-main-row {
    display: grid;
    grid-template-columns: 2fr auto auto auto;
    gap: 3rem;
    align-items: start;
    justify-content: end;
}

.footer-bottom-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    padding-top: 1rem;
    flex-wrap: wrap; /* Позволяет элементам переноситься на новую строку */
    gap: 1rem; /* Отступ между элементами при переносе */
}

.footer-contact,
.footer-links,
.footer-social {
    min-width: 0; /* Позволяет элементам сжиматься */
}

.footer-links {
    display: flex;
    flex-wrap: wrap; /* Позволяет ссылкам переноситься */
    gap: 1rem;
}

.footer-links a {
    white-space: nowrap; /* Предотвращает разрыв отдельных ссылок */
}

/* Секции подвала */
.footer-section {
    display: flex;
    flex-direction: column;
    min-width: 0; /* Позволяет flex элементам сжиматься */
}

/* Блок лицензии в футере */
.footer-license-section {
    margin-top: 2rem;
    padding-top: 0;
}

.footer-license-section h5 {
    font-size: var(--font-size-sm);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
    margin-bottom: 1rem;
    letter-spacing: 0.5px;
}

.footer-license-image {
    max-width: 140px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease;
}

.footer-license-image:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.08);
}

.footer-license-image {
    cursor: pointer;
}

.footer-license-image img {
    width: 100%;
    height: auto;
    display: block;
}

/* Модальное окно для лицензии */
.license-modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 10000;
    justify-content: center;
    align-items: center;
    padding: 20px;
    box-sizing: border-box;
}

/* JS (main.js initLicenseModal) переключает класс .active. Без этого правила
   оверлей оставался display:none: попап не показывался, а scroll-lock всё равно
   срабатывал — скролл «пропадал», страница замирала. */
.license-modal-overlay.active {
    display: flex;
}

.license-modal {
    background: var(--color-white);
    border-radius: 12px;
    max-width: 95vw;
    width: 620px;
    max-height: 95vh;
    position: relative;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.license-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
}

.license-modal-header h3 {
    margin: 0;
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    color: var(--color-text-primary);
}

.license-modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--color-text-secondary);
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.license-modal-close:hover {
    background-color: rgba(51, 51, 51, 0.1);
    color: var(--color-text-primary);
}

.license-modal-content {
    padding: 0 1rem 1rem;
    text-align: center;
    max-height: calc(95vh - 100px);
    overflow: auto;
    display: flex;
    align-items: center;
    justify-content: center;
}

.license-image-wrapper {
    width: 100%;
    max-height: calc(95vh - 120px);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.license-modal-content img {
    max-width: 90%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.footer-section ul {
    min-width: 0; /* Позволяет списку сжиматься */
}

.footer-section li {
    min-width: 0; /* Позволяет элементам списка сжиматься */
}

.footer-section a {
    word-wrap: break-word; /* Переносит длинные слова */
    overflow-wrap: break-word; /* Современная версия word-wrap */
    hyphens: auto; /* Автоматические переносы */
    line-height: 1.4; /* Улучшенная читаемость при переносе */
}

/* Левая секция с логотипом */
.footer-left {
    padding-right: 2rem;
}

.footer-left .footer-logo-image {
    height: 48px;
    width: auto;
}

.footer-left .btn {
    align-self: flex-start;
    margin-top: auto;
}

.footer-title {
    margin-bottom: 1.5rem;
}

/* Колонки меню */
.footer-menu {
    text-align: left;
    min-width: max-content;
}

.footer-menu h5 {
    margin-bottom: 1.5rem;
}

.footer-menu ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.footer-menu ul li {
    margin-bottom: 0.75rem;
}

.footer-menu ul li a {
    text-decoration: none;
    transition: color 0.3s ease;
    color: var(--color-text-primary);
}

.footer-menu ul li a:hover {
    color: var(--color-primary);
}

/* Правая секция с контактами */
.footer-right {
    display: flex;
    flex-direction: row;
    gap: 3rem;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

/* Стили для кликабельного телефона и почты в подвале */
.footer-phone {
    font-family: var(--font-primary);
    font-size: var(--font-size-24);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    color: var(--color-text-main);
    text-decoration: none;
    transition: color 0.3s ease;
    margin: 0;
    display: block;
}

.footer-phone:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.footer-email {
    font-family: var(--font-primary);
    font-size: var(--font-size-22);
    font-weight: var(--font-weight-semibold);
    line-height: 1.3;
    color: var(--color-text-main);
    text-decoration: none;
    transition: color 0.3s ease;
    margin: 0;
    display: block;
}

.footer-email:hover {
    color: var(--color-primary);
    text-decoration: none;
}

.footer-links {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    justify-content: center;
    flex: 1;
}

.footer-links a {
    transition: color 0.3s ease;
    color: var(--color-text-primary);
}

.footer-links a:hover {
    color: var(--color-primary);
}

.footer-social {
    display: flex;
    gap: 1rem;
    margin-top: auto;
}

.footer-social .social-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 54px;
    height: 54px;
    text-decoration: none;
    padding: 0;
}

/* Rutube иконка как фон, как у остальных */
.footer-social .social-link.rutube {
    background-image: url('../img/Rutube_green_icon.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.footer-social .social-link.rutube:hover {
    background-image: url('../img/Rutube_green_icon_hover.svg');
}

/* === АДАПТИВНОСТЬ === */

@media screen and (max-width: 1024px) {
    .footer-sections {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 1.5rem;
    }
    
    .footer-left {
        grid-column: 1 / -1;
        padding-right: 0;
        margin-bottom: 2rem;
    }
}

@media screen and (max-width: 768px) {
    .footer-content {
        padding: 2rem 0;
    }
    
    .footer-sections {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-left {
        text-align: center;
        margin-bottom: 2rem;
    }
    
    .footer-btn {
        align-self: center;
    }
    
    .footer-social {
        justify-content: flex-start;
    }

    .footer-left .btn {
        margin-inline: auto;
    }
}

@media screen and (max-width: 480px) {
    .footer-content {
        padding: 1.5rem 0;
    }
    
    .footer-social .social-link {
        width: 46px;
        height: 46px;
    }
    
    .footer-social .social-link img {
        width: 46px;
        height: 46px;
    }

    /* Модальное окно лицензии на очень маленьких экранах */
    .license-modal { width: 98vw; max-height: 98vh; }
    .license-modal-content { max-height: calc(98vh - 80px); }
    .license-image-wrapper { max-height: calc(98vh - 100px); }
}

.footer-section h3::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 40px;
    height: 2px;
    background: var(--color-primary);
    border-radius: 1px;
}

/* Логотип в подвале */
.footer-logo {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.footer-logo-text {
    color: var(--color-white);
}

/* Описание */
.footer-description {
    color: rgba(255, 255, 255, 0.8);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

/* Контактная информация */
.footer-contact {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-contact p {
    margin: 0;
    line-height: 1.4;
}

.footer-contact strong {
    color: var(--color-white);
}

.footer-contact a {
    text-decoration: none;
}

.footer-contact a:hover {
    color: var(--color-white);
}

/* Навигация в подвале */
.footer-nav {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.footer-nav li {
    margin: 0;
}

.footer-nav a {
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    display: block;
    padding: 0.25rem 0;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
}

.footer-nav a:hover {
    color: var(--color-white);
    border-left-color: var(--color-primary);
    padding-left: 1rem;
    transform: translateX(5px);
}

/* Социальные сети */
.social-links {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.social-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    padding: 0.75rem;
    border-radius: 8px;
    transition: all 0.3s ease;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.social-link svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Нижняя часть подвала */
.footer-bottom {
    background: rgba(0, 0, 0, 0.2);
    padding: 1.5rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-bottom-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
}

.footer-copyright {
    color: rgba(255, 255, 255, 0.7);
    margin: 0;
}

.footer-links {
    display: flex;
    gap: 2rem;
    flex-wrap: wrap;
}

.footer-links a {
    transition: all 0.3s ease;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
}

.footer-links a:hover {
    color: var(--color-primary);
}

/* === АДАПТИВНОСТЬ === */

/* Планшеты */
@media screen and (max-width: 1024px) {
    .footer-main-row {
        grid-template-columns: 1fr 1fr;
        gap: 2rem;
        justify-content: start;
    }
    
    .footer-menu {
        text-align: left;
    }
    
    .footer-left {
        grid-column: 1 / -1;
        padding-right: 0;
        margin-bottom: 1rem;
    }
    
    .footer-bottom-row {
        flex-direction: column;
        gap: 1.5rem;
        align-items: flex-start;
    }
    
    .footer-links {
        flex-direction: row;
        gap: 1rem;
    }
    
    .footer-content {
        padding: 2.5rem 0 1.5rem;
    }
}

/* Мобильные устройства */
@media screen and (max-width: 768px) {
    .footer-content {
        padding: 2rem 0 1rem;
    }
    /* Крупнее фон и прижат к нижней границе контейнера */
    footer { background-size: 240% auto; background-repeat: no-repeat; background-position: left bottom; }
    
    .footer-main-row {
        grid-template-columns: 1fr;
        gap: 2rem;
    }
    
    .footer-menu {
        text-align: left;
    }
    
    .footer-section h3 {
        margin-bottom: 1rem;
    }
    
    .footer-logo {
        justify-content: flex-start;
        text-align: left;
    }
    
    .footer-description {
        text-align: left;
        margin-bottom: 1rem;
    }
    
    .footer-contact {
        text-align: left;
    }

    /* Текст слева, кнопка справа в одной строке */
    .footer-left {
        display: grid;
        grid-template-columns: 1fr auto;
        row-gap: 0.75rem;
        align-items: center;
    }
    .footer-left .footer-logo { grid-column: 1 / -1; margin-bottom: 0.25rem; }
    .footer-left .footer-title { margin: 0; text-align: left; }
    .footer-left .btn { justify-self: end; margin: 0; }
    
    .footer-nav {
        align-items: flex-start;
        text-align: left;
    }
    
    .footer-nav a {
        border-left: none;
        border-bottom: 1px solid transparent;
        padding: 0.5rem 0;
    }
    
    .footer-nav a:hover {
        border-left: none;
        border-bottom-color: var(--color-primary);
        padding-left: 0;
        transform: none;
    }
    
    .social-links {
        align-items: flex-start;
    }
    
    .social-link {
        justify-content: flex-start;
    }
    
    .footer-bottom-content {
        flex-direction: column;
        text-align: left;
        gap: 1rem;
        align-items: flex-start;
        width: 100%;
    }
    
    .footer-links {
        justify-content: flex-start;
        gap: 1rem;
        flex-direction: column;
        text-align: left;
    }

    /* Вся нижняя строка тоже выравнивается по левому краю */
    .footer-bottom-row {
        align-items: flex-start;
        justify-content: flex-start;
        text-align: left;
        width: 100%;
    }

    /* Выравниваем границы подвала: фиксированный отступ 20px слева и справа */
    footer .container { padding-left: 20px; padding-right: 20px; }
    
    /* Адаптивность блока лицензии на планшетах */
    .footer-license-section {
        margin-top: 1.5rem;
        padding-top: 0;
    }
    
    .footer-license-image {
        max-width: 120px;
    }

    /* Модальное окно лицензии на планшетах/мобилках */
    .license-modal { width: 96vw; max-height: 96vh; }
    .license-modal-content { max-height: calc(96vh - 90px); }
    .license-image-wrapper { max-height: calc(96vh - 110px); }
}

/* Очень маленькие экраны */
@media screen and (max-width: 480px) {
    .footer-content {
        padding: 1.5rem 0 1rem;
    }
    /* На очень маленьких экранах — крупнее и прижат к низу контейнера */
    footer { background-size: 220% auto; background-position: left bottom; }
    
    .footer-sections {
        gap: 1.5rem;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 0.5rem;
        text-align: left;
        align-items: flex-start;
    }

    /* Очень маленькие экраны: также 20px слева и справа */
    footer .container { padding-left: 20px; padding-right: 20px; }
    
    /* Дополнительная адаптивность для очень маленьких экранов */
    .footer-bottom-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .footer-contact {
        width: 100%;
    }
    
    .footer-links {
        width: 100%;
    }
    
    .footer-social {
        width: 100%;
        justify-content: flex-start;
    }
}

/* Экстра маленькие экраны (320px и меньше) */
@media screen and (max-width: 320px) {
    .footer-content {
        padding: 1rem 0 0.5rem;
    }
    
    footer .container {
        padding-left: 15px;
        padding-right: 15px;
    }
    
    .footer-main-row {
        gap: 1rem;
    }
    
    .footer-sections {
        gap: 1rem;
    }
    
    .footer-section a {
        font-size: 0.9em; /* Немного уменьшаем шрифт на очень маленьких экранах */
    }
    
    /* Адаптивность блока лицензии на маленьких экранах */
    .footer-license-section {
        margin-top: 1rem;
        padding-top: 0;
    }
    
    .footer-license-image {
        max-width: 100px;
    }
    
    /* Адаптивность модального окна на маленьких экранах */
    .license-modal {
        max-width: 98vw;
        max-height: 98vh;
    }
    
    .license-modal-header {
        padding: 0.75rem;
    }
    
    .license-modal-content {
        padding: 0.5rem;
        max-height: calc(98vh - 80px);
    }
}

/* Большие экраны */
@media screen and (min-width: 1400px) {
    .footer-content {
        padding: 4rem 0 2.5rem;
    }
    
    .footer-sections {
        gap: 3rem;
    }
    
    .footer-section h3 {
        margin-bottom: 2rem;
    }
    
    .footer-description {
        margin-bottom: 2rem;
    }
    
    .footer-contact {
        gap: 1rem;
    }
    
    .footer-nav {
        gap: 1rem;
    }
    
    .social-links {
        gap: 1.25rem;
    }
    
    .social-link {
        padding: 1rem;
    }
}
