/* Изолированные стили для футера - не зависят от других стилей страницы */

/* Основные стили футера */
footer {
    background-color: #666666 !important;
    color: #ffffff !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
}

/* Remove any min-height coming from bundles */
html body footer {
    min-height: auto !important;
    height: auto !important;
}

/* Контейнер футера */
footer .container {
    color: #ffffff !important;
    text-align: left !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
}

/* Убираем отступы у контейнера над footer-bottom */
footer .container:last-of-type {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Убираем отступы у всех элементов перед footer-bottom */
footer > div:not(.footer-bottom) {
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
}

/* Максимальная специфичность для принудительного белого цвета контактов */
html body footer .col-md-4:last-child * {
    color: #ffffff !important;
}

html body footer .col-md-4:last-child h2,
html body footer .col-md-4:last-child p,
html body footer .col-md-4:last-child a,
html body footer .col-md-4:last-child span {
    color: #ffffff !important;
    text-align: center !important;
}

/* Максимальная специфичность для footer-bottom */
html body footer .footer-bottom * {
    color: #ffffff !important;
}

html body footer .footer-bottom p,
html body footer .footer-bottom span,
html body footer .footer-bottom div,
html body footer .footer-bottom .footer-copyright,
html body footer .footer-bottom .unp-sep,
html body footer .footer-bottom .footer-unp {
    color: #ffffff !important;
}

/* Увеличиваем размер шрифта во всем футере на 2 пункта */
html body footer h2 {
    font-size: 20px !important;
}

html body footer p {
    font-size: 16px !important;
}

html body footer a {
    font-size: 16px !important;
}

/* Увеличиваем размер шрифта для навигационных ссылок в среднем блоке */
html body footer .footer-text1 h2,
html body footer .footer-text1 a {
    font-size: 22px !important;
}

/* Одинаковые отступы сверху и снизу для блоков навигации и контактов */
html body footer .col-md-4:nth-child(2) .card-body,
html body footer .col-md-4:last-child .card-body {
    padding-top: 15px !important;
    padding-bottom: 20px !important;
}

/* Уменьшаем расстояние между строками в блоке КОНТАКТЫ */
html body footer .col-md-4:last-child .card-body h2,
html body footer .col-md-4:last-child .card-body p {
    margin-bottom: 3px !important;
    line-height: 1.2 !important;
}

html body footer .col-md-4:last-child .card-body h2 {
    margin-bottom: 6px !important;
}

/* Строка футера */
footer .row {
    margin-left: 0 !important;
    margin-right: 0 !important;
    min-height: 200px !important; /* единая высота основного блока футера на десктопе */
    align-items: center !important;
}

/* Колонки футера */
footer .col-md-4 {
    text-align: left !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Логотип в футере */
footer .footerLogo {
    display: block !important;
    text-align: left !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

/* Выравнивание для первой колонки (логотип) */
footer .col-md-4:first-child {
    justify-content: flex-start !important;
}

/* Выравнивание для второй колонки (навигация) */
footer .col-md-4:nth-child(2) {
    justify-content: center !important;
}

/* Выравнивание для третьей колонки (контакты) */
footer .col-md-4:last-child {
    justify-content: flex-end !important;
}

/* Контейнер логотипа */
footer .footerIcon {
    margin-bottom: 0 !important;
}

footer .footerImg {
    width: 108px !important;
    height: auto !important;
    max-width: 108px !important;
}

/* Навигационные ссылки */
footer .footer-text1 {
    text-align: left !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

footer .footer-text1 h2 {
    color: #ffffff !important;
    font-size: 22px !important;
    margin-bottom: 4px !important;
    line-height: 1.1 !important;
    font-weight: normal !important;
}

/* Remove bottom margin on the last nav item */
footer .footer-text1 h2:last-child {
    margin-bottom: 0 !important;
}

/* Mobile: make spacing even tighter */
@media (max-width: 768px) {
  footer .footer-text1 h2 {
    margin-bottom: 3px !important;
    line-height: 1.05 !important;
  }
  footer .footer-text1 h2:last-child {
    margin-bottom: 0 !important;
  }
}

footer .footer-text1 a {
    color: #ffffff !important;
    text-decoration: none !important;
}

/* Контактная информация */
footer .footer-text3 {
    text-align: center !important;
    margin-top: 20px !important;
    margin-bottom: 20px !important;
}

/* Убираем лишние отступы у контейнеров футера */
footer .card-body {
    margin-bottom: 0 !important;
}

footer .footer-text3 h2 {
    color: #ffffff !important;
    font-size: 19px !important;
    margin-bottom: 15px !important;
    font-weight: normal !important;
}

footer .footer-text3 p {
    color: #ffffff !important;
    margin-bottom: 8px !important;
    font-size: 17px !important;
}

footer .contact-phoneFooter {
    color: #ffffff !important;
    text-decoration: none !important;
}

footer .footer-email {
    color: #ffffff !important;
}

/* Нижняя часть футера */
footer .footer-bottom {
    background-color: #313131 !important;
    color: #ffffff !important;
    padding: 10px 0 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    min-height: auto !important;
}

/* Strong override to remove any gap above footer-bottom from other bundles */
html body footer .footer-bottom {
    margin-top: 0 !important;
}

/* Принудительно устанавливаем белый цвет для всех элементов footer-bottom */
footer .footer-bottom * {
    color: #ffffff !important;
}

footer .footer-bottom p,
footer .footer-bottom span,
footer .footer-bottom div {
    color: #ffffff !important;
}

footer .footer-bottom p {
    color: #ffffff !important;
    margin-bottom: 0 !important;
    font-size: 14px !important;
}

/* Reduce font size by 2px for right development text only */
footer .footer-bottom .footer-bottom_p2 p {
    font-size: 11px !important;
}

/* Match the same font size for the left copyright text */
footer .footer-bottom .footer-bottom_p1 p {
    font-size: 11px !important;
}

/* Hover эффекты для ссылок в футере */
footer a.linkServicesFooter:hover,
footer .footer-text1 a:hover,
footer a[href*="catalogs"]:hover,
footer a[href*="brochures"]:hover,
footer a[href*="books"]:hover,
footer a[href*="services"]:hover {
    color: rgb(51, 55, 140) !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

footer a.contact-phoneFooter:hover,
footer a[href^="tel:"]:hover {
    color: rgb(51, 55, 140) !important;
    text-decoration: none !important;
    transition: color 0.3s ease !important;
}

/* Специальные стили для страницы контактов */
footer:has(.footer-bottom:only-child) {
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    background-color: #313131 !important;
}

/* Стили для предотвращения переноса номера 229 в адресе для писем */
footer p[style*="width: 320px"] {
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Переопределяем стили из index-overrides.css для адреса писем */
html body footer .footer-text3 p[style*="width: 320px"] {
    text-align: center !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
}

/* Выравниваем весь блок контактов по правой стороне */
html body footer .footer-text3 {
    text-align: center !important;
}

html body footer .footer-text3 h2,
html body footer .footer-text3 p,
html body footer .footer-text3 a {
    text-align: center !important;
    color: #ffffff !important;
}

/* Принудительно устанавливаем белый цвет для всех элементов контактов */
html body footer .col-md-4:last-child,
html body footer .col-md-4:last-child .card-body,
html body footer .col-md-4:last-child .card-body div,
html body footer .col-md-4:last-child .card-body h2,
html body footer .col-md-4:last-child .card-body p,
html body footer .col-md-4:last-child .card-body a,
html body footer .col-md-4:last-child .card-body span {
    color: #ffffff !important;
}

/* Выравнивание по правой стороне ТОЛЬКО на десктопе */
@media (min-width: 769px) {
  html body footer .col-md-4:last-child,
  html body footer .col-md-4:last-child .card-body,
  html body footer .col-md-4:last-child .card-body div,
  html body footer .col-md-4:last-child .card-body h2,
  html body footer .col-md-4:last-child .card-body p,
  html body footer .col-md-4:last-child .card-body a,
  html body footer .col-md-4:last-child .card-body span {
      text-align: right !important;
  }
}

/* Center the contacts heading specifically on mobile */
@media (max-width: 768px) {
  html body footer .col-md-4:last-child .card-body.footer-text3 h2 {
      text-align: center !important;
  }
}

/* Mobile-only: force-center contacts heading with highest specificity */
@media (max-width: 768px) {
  html body footer .col-md-4:last-child .card-body.footer-text3 h2,
  html body footer .col-md-4:last-child .card-body.footer-text3 > div > h2,
  html body footer .footer-text3 h2 {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: block !important;
  }
}

/* Адаптивные стили для мобильных устройств */
@media (max-width: 768px) {
    footer {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    /* На мобильных высота авто, чтобы ничего не обрезалось */
    footer .row {
        min-height: auto !important;
    }
    
    /* На мобильных устройствах разрешаем перенос для адреса писем */
    footer p[style*="width: 320px"] {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }
    
    /* Переопределяем стили из index-overrides.css для мобильных */
    html body footer .footer-text3 p[style*="width: 320px"] {
        text-align: center !important;
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: initial !important;
    }
    
    /* На мобильных устройствах центрируем блок контактов (для всех страниц, КРОМЕ contacts) */
    html body main:not(.contacts) ~ footer .footer-text3,
    html body main:not(.contacts) ~ footer .footer-text3 h2,
    html body main:not(.contacts) ~ footer .footer-text3 p,
    html body main:not(.contacts) ~ footer .footer-text3 a {
        text-align: center !important;
        margin-left: auto !important;
        margin-right: auto !important;
    }
    html body main:not(.contacts) ~ footer .footer-text3 {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        justify-content: center !important;
    }
    /* Для страницы контактов сохраняем выравнивание по правому краю */
    html body main.contacts ~ footer .footer-text3,
    html body main.contacts ~ footer .footer-text3 h2,
    html body main.contacts ~ footer .footer-text3 p,
    html body main.contacts ~ footer .footer-text3 a {
        text-align: right !important;
    }
    
    footer .col-md-4 {
        text-align: center !important;
        margin-bottom: 20px !important;
    }
    
    footer .footerLogo {
        text-align: center !important;
    }
    
    footer .footer-text1 {
        text-align: center !important;
    }
    
    /* Для страницы контактов на мобильных */
    footer:has(.footer-bottom:only-child) {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
}

@media (max-width: 480px) {
    footer {
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }
    
    footer .footerImg {
        width: 90px !important;
        max-width: 90px !important;
    }
}

/* Ensure zero bottom padding on very small screens (override any later rules) */
@media (max-width: 480px) {
  html body footer { padding-bottom: 0 !important; }
}

@media (max-width: 768px) {
  /* Uniform mobile layout for contacts (non-contacts pages) */
  html body main:not(.contacts) ~ footer .footer-text3 > div {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }
  /* Set equal spacing for every line */
  html body main:not(.contacts) ~ footer .footer-text3 h2,
  html body main:not(.contacts) ~ footer .footer-text3 p,
  html body main:not(.contacts) ~ footer .footer-text3 .footer-email {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.25 !important;
    text-align: center !important;
  }
  /* Phones: keep in one line but use the same 6px spacing */
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter {
    white-space: nowrap !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
  }
  /* Remove fixed width and allow wrapping for 'Для писем' line */
  html body main:not(.contacts) ~ footer .footer-text3 p[style*="width: 320px"] {
    width: auto !important;
    max-width: 100% !important;
    white-space: normal !important;
    margin-top: 6px !important;
    margin-bottom: 6px !important;
  }
}

@media (max-width: 768px) {
  /* Mobile: center contacts block and all inner elements (except on contacts page) */
  html body main:not(.contacts) ~ footer .footer-text3,
  html body main:not(.contacts) ~ footer .footer-text3 h2,
  html body main:not(.contacts) ~ footer .footer-text3 p,
  html body main:not(.contacts) ~ footer .footer-text3 a,
  html body main:not(.contacts) ~ footer .footer-text3 span,
  html body main:not(.contacts) ~ footer .footer-text3 .contact-phoneFooter,
  html body main:not(.contacts) ~ footer .footer-text3 .footer-email {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  /* Ensure the fixed-width 'Для писем' line is centered */
  html body main:not(.contacts) ~ footer .footer-text3 p[style*="width: 320px"] {
    margin-left: auto !important;
    margin-right: auto !important;
  }
}

@media (max-width: 768px) {
  /* Center and unfix width for the 'Для писем' line on non-contacts pages */
  html body main:not(.contacts) ~ footer .footer-text3 p[style*="width: 320px"] {
    width: auto !important;
    max-width: 100% !important;
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    white-space: normal !important;
  }
}

@media (max-width: 768px) {
  /* Equal vertical spacing between contacts items on non-contacts pages */
  html body main:not(.contacts) ~ footer .footer-text3 > * {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
  }
}

@media (max-width: 768px) {
  /* Normalize spacing: remove varying margins and set equal gap */
  html body main:not(.contacts) ~ footer .footer-text3 h2,
  html body main:not(.contacts) ~ footer .footer-text3 p,
  html body main:not(.contacts) ~ footer .footer-text3 .contact-phoneFooter,
  html body main:not(.contacts) ~ footer .footer-text3 .footer-email {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    display: block !important;
  }
  /* Ensure anchors inside phone paragraph don't add extra spacing */
  html body main:not(.contacts) ~ footer .footer-text3 p a.contact-phoneFooter {
    margin: 0 !important;
    padding: 0 !important;
    line-height: inherit !important;
  }
}

@media (max-width: 768px) {
  /* Use flex column with consistent spacing for contacts (non-contacts pages) */
  html body main:not(.contacts) ~ footer .footer-text3 {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
  }
  /* Default vertical spacing between items */
  html body main:not(.contacts) ~ footer .footer-text3 > * {
    margin-top: 8px !important;
    margin-bottom: 8px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
  }
  /* Halve spacing for address lines (street and 'Для писем') */
  html body main:not(.contacts) ~ footer .footer-text3 p:not(.contact-phoneFooter):not(.footer-email) {
    margin-top: 4px !important;
    margin-bottom: 4px !important;
  }
}

@media (max-width: 768px) {
  /* Phones in one line, centered */
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter {
    white-space: nowrap !important;
    display: inline-block !important;
    width: auto !important;
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
  }
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter a.contact-phoneFooter {
    display: inline !important;
    margin: 0 1px !important; /* tighter spacing between numbers */
    padding: 0 !important;
  }
}

@media (max-width: 768px) {
  /* Reduce interline spacing for all lines in contacts block */
  html body main:not(.contacts) ~ footer .footer-text3 p,
  html body main:not(.contacts) ~ footer .footer-text3 .footer-email,
  html body main:not(.contacts) ~ footer .footer-text3 h2 {
    line-height: 1.15 !important;
  }
  /* Slightly tighter for phone line if it wraps */
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter {
    line-height: 1.1 !important;
  }
}

@media (max-width: 768px) {
  /* Equal spacing for each line inside contacts wrapper on non-contacts pages */
  html body main:not(.contacts) ~ footer .footer-text3 > div > * {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.25 !important;
    text-align: center !important;
  }
}

@media (max-width: 768px) {
  /* Tighten space between phones and street address to 0px */
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter {
    margin-bottom: 0 !important;
  }
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter + p {
    margin-top: 0 !important;
  }
}

@media (max-width: 768px) {
  /* Restore zero gap between phone and address lines */
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter + p {
    margin-top: 0 !important;
  }
}

@media (max-width: 768px) {
  /* Zero gap between 'Для писем' line and email */
  html body main:not(.contacts) ~ footer .footer-text3 p[style*="width: 320px"] {
    margin-bottom: 0 !important;
  }
  html body main:not(.contacts) ~ footer .footer-text3 p[style*="width: 320px"] + p.footer-email {
    margin-top: 0 !important;
  }
}

@media (max-width: 768px) {
  /* Increase interline spacing inside the 'Для писем' paragraph on mobile */
  html body main:not(.contacts) ~ footer .footer-text3 p:has(.letters-label) {
    line-height: 1.5 !important;
  }
}

@media (max-width: 768px) {
  /* Increase spacing around the 'Для писем' paragraph (larger) */
  html body main:not(.contacts) ~ footer .footer-text3 p:has(.letters-label) {
    line-height: 1.6 !important;
    margin-bottom: 24px !important;
  }
  html body main:not(.contacts) ~ footer .footer-text3 p:has(.letters-label) + p.footer-email {
    margin-top: 24px !important;
  }
}

@media (max-width: 768px) {
  /* Revert: disable uniform gap spacing */
  html body main:not(.contacts) ~ footer .footer-text3 > div {
    gap: 0 !important;
  }
  /* Restore per-line margins */
  html body main:not(.contacts) ~ footer .footer-text3 h2,
  html body main:not(.contacts) ~ footer .footer-text3 p,
  html body main:not(.contacts) ~ footer .footer-text3 .footer-email {
    margin-top: 6px !important;
    margin-bottom: 6px !important;
    padding-top: 0 !important;
    padding-bottom: 0 !important;
    line-height: 1.25 !important;
    text-align: center !important;
  }
  /* Phones in one line and tight pairing with address */
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter {
    white-space: nowrap !important;
    margin-bottom: 0 !important;
  }
  html body main:not(.contacts) ~ footer .footer-text3 p.contact-phoneFooter + p {
    margin-top: 0 !important;
  }
  /* Larger spacing around 'Для писем' and email */
  html body main:not(.contacts) ~ footer .footer-text3 p:has(.letters-label) {
    line-height: 1.6 !important;
    margin-top: 6px !important;
    margin-bottom: 24px !important;
  }
  html body main:not(.contacts) ~ footer .footer-text3 p:has(.letters-label) + p.footer-email {
    margin-top: 24px !important;
  }
}
