/* Dopolnitelnye stili k shablonu: modalnoe okno, poisk, uvedomlenie o cookie.
   Всё остальное оформление — из templates/template_demotesto/css. */

/* --- Modalnoe okno "sdelat raschet" --- */
.site-modal { position: fixed; inset: 0; z-index: 99999; display: flex; align-items: center; justify-content: center; }
.site-modal[hidden] { display: none; }
.site-modal-overlay { position: absolute; inset: 0; background: rgba(0, 0, 0, .6); }
.site-modal-box {
    position: relative; z-index: 2; width: 100%; max-width: 500px; margin: 15px;
    background: #fff; border-radius: 4px; padding: 24px 24px 18px; box-sizing: border-box;
    max-height: 92vh; overflow-y: auto; box-shadow: 0 8px 30px rgba(0, 0, 0, .3);
}
.site-modal-close {
    position: absolute; top: 6px; right: 10px; border: 0; background: transparent;
    font-size: 28px; line-height: 1; color: #999; cursor: pointer; padding: 0 4px;
}
.site-modal-close:hover { color: #333; }
.site-modal .cf-control-group { margin-bottom: 12px; }
.site-modal .cf-input { width: 100%; box-sizing: border-box; }
.site-modal h3 { margin: 0 0 6px; color: #333; }
body.modal-open { overflow: hidden; }

/* Otvet posle otpravki formy */
.site-form-note { margin: 10px 0 0; padding: 10px 14px; border-radius: 3px; font-size: 14px; }
.site-form-note.ok { background: #e8f7e6; color: #2b6b23; }
.site-form-note.error { background: #fdeaea; color: #8a2020; }

/* --- Zhivoy poisk ---
   Показ списка управляется классом .expanded: его ждёт CSS модуля
   (.fade-effect .mls-results-cont.expanded { opacity:1; visibility:visible }).
   Позиционирование оставляем как в модуле (position:absolute) — иначе список
   «встаёт в поток» и растягивает шапку. */
.mls-results-cont { position: absolute; }          /* absolutnoe pozicionirovanie - inache spisok rashoduet shapku */
.mls-results {
    background: #fff;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .16);
    max-height: 420px;
    overflow-y: auto;
}
.mls-results .mls-result-item { display: block; padding: 8px 12px; border-bottom: 1px solid #eee; text-decoration: none; }
.mls-results .mls-result-item:last-child { border-bottom: 0; }
.mls-results .mls-result-item:hover { background: #f2f8ff; }
.mls-results .mls-result-item b { display: block; font-weight: 600; font-size: 14px; color: #186bbb; line-height: 1.25; }
.mls-results .mls-result-item span { display: block; font-size: 12px; color: #666; line-height: 1.3; max-height: 32px; overflow: hidden; }
.mls-results .mls-result-item mark { background: #fff3b8; color: inherit; padding: 0 1px; }
.mls-results .mls-empty { padding: 10px 12px; color: #777; font-size: 13px; }

/* Ssylki v podvale - belye. Podval sinij (#186bbb), a obshchij stil sajta krasit
   ssylki v tot zhe sinij: adres e-mail i "Karta sajta" byli ne vidny (kontrast 1.0).
   Pravilo perekryvaet i .footers div:last-child a iz modules.css. */
#foot .footers a { color: #fff; }
#foot .footers a:hover { color: #e7760b; }
/* "App icon by icon8" - pri glushennyj, no chitaemyj: #c3cbd2 iz shablona daval
   kontrast 3.31 (nizhe normy AA 4.5), podnyali do 4.5 */
#foot .footers a.footlinkicon { color: #e6eaee !important; }
#foot .footers a.footlinkicon:hover { color: #fff !important; }

/* --- Pravovye ssylki v podvale (#fz_wrap) --- */
#fz_wrap a { margin-right: 14px; font-size: 12px; display: inline-block; white-space: nowrap; }
#fz_wrap .sep { color: #c3cbd2; }

/* Na uzkih ekranah ssylki vstayut v stolbik, razdely "|" skryvaem -
   inache dlinnaya ssylka perenositsya na dve stroki i ee seredina perehvatyvaet klik */
@media screen and (max-width: 768px) {
    #fz_wrap p { display: flex; flex-direction: column; gap: 6px; margin: 0; }
    #fz_wrap a { margin-right: 0; }
    #fz_wrap .sep { display: none; }
}

/* --- Stranica rezultatov poiska --- */
.search-results { list-style: none; padding: 0; margin: 0; }
.search-results li { margin-bottom: 18px; }
.search-results a { font-size: 17px; }
.search-results p { margin: 4px 0 0; color: #555; }

/* ============================================
   Уведомление о cookie — как на yantary.ru
   (всплывает снизу, кнопка «Принять», повтор через сутки)
   ============================================ */
.cookie-overlay {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: auto;
    box-sizing: border-box;
    z-index: 9999;
    transform: translateY(100%);
    transition: transform 0.4s ease-in-out;
}
.cookie-overlay.active { transform: translateY(0); }

.cookie-container {
    background: linear-gradient(135deg, #186BBB 0%, #315F8C 55%, #08427A 100%);
    border-top: 0;
    max-width: 800px;
    padding: 2rem 1.5rem 3rem;
    display: flex;
    border-radius: 0 20px 0 0;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, .12);
}

.cookie-text {
    color: #fff;
    font-size: 14px;
    line-height: 1.4;
    flex: 1;
    min-width: 200px;
}
.cookie-text a { color: #fff; font-weight: 600; transition: color .2s; }
.cookie-text a:hover { color: #73A9DD; text-decoration: none; }

.cookie-button {
    background-color: transparent;
    border: 2px solid #fff;
    color: #fff;
    padding: 10px 20px 12px;
    font-size: 14px;
    border-radius: 10px;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color .2s, color .2s;
}
.cookie-button:hover { background-color: #fff; border-color: #fff; color: #08427A; }

@media screen and (max-width: 768px) {
    .cookie-container { flex-direction: column; text-align: center; padding: 1rem 1rem 3.5rem; border-radius: 0; }
    .cookie-text { font-size: .85rem; }
    .cookie-button { width: 100%; text-align: center; padding: .7rem; }
}

/* Poka banner cookie vidim, dobavlyaem podvalu otstup snizu:
   banner prikleen k nizu ekrana i inache perekryvaet pravovye ssylki */
body.cookie-open #fz_wrapper { padding-bottom: 150px; transition: padding-bottom .3s ease; }
@media screen and (max-width: 768px) {
    body.cookie-open #fz_wrapper { padding-bottom: 250px; }
}

/* --- Karta sajta (HTML) --- */
.sitemap-tree ul { list-style: none; padding-left: 0; margin: 0 0 0 0; }
.sitemap-tree > ul > li { margin-bottom: 6px; font-size: 17px; }
.sitemap-tree ul ul { padding-left: 22px; margin-top: 6px; }
.sitemap-tree ul ul li { font-size: 15px; margin-bottom: 4px; }
.sitemap-tree h2 { margin: 26px 0 10px; }


/* ============================================
   Узкие экраны: убираем горизонтальную прокрутку страницы
   (на телефоне страница «уезжала» вбок из-за поиска и широких таблиц)
   ============================================ */
@media screen and (max-width: 900px) {

    /* 1. Forma poiska v shapke. V Joomla shirinu podgonyal skript modulya,
          u nas ee zadaet CSS: ogranichivaem po roditelyu. */
    .headinfo-search {
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
    }
    .headinfo-search .mls-form,
    .headinfo-search .mls-form-inner,
    .headinfo-search .mls-parent,
    .headinfo-search .mls-results-cont,
    .headinfo-search .mls-results {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }
    .headinfo-search input.mls-query {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box;
    }

    /* 2. Tablicy na uzkih ekranah.
          Problema: tablica szhimaetsya do shiriny ekrana, i yachejki nachinayut naezzhat
          drug na druga (v tablicah po 11-16 kolonok). Reshenie: tablica sohranyaet
          estestvennuyu shirinu, a prokrutka idet VNUTRI bloka (stranica ne ezzhaet). */
    .table-with-scroll,
    .table-head-sticky,
    .table-scroll-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        max-width: 100%;
    }
    .table-with-scroll table,
    .table-head-sticky table,
    .table-scroll-wrap table {
        min-width: max-content;       /* tablica ne szhimaetsya po shirine ekrana */
    }
    /* yachejki-obedineniya (colspan) - razreshaem perenos, inache zagolovok uezzhaet za tablicu */
    .table-with-scroll [colspan],
    .table-head-sticky [colspan],
    .table-scroll-wrap [colspan] {
        white-space: normal;
    }
    /* pervaya kolonka (marka stali) ostaetsya na meste pri prokrutke vbok */
    .table-with-scroll > table > thead > tr > th:first-child,
    .table-with-scroll > table > tbody > tr > td:first-child,
    .table-head-sticky > table > thead > tr > th:first-child,
    .table-head-sticky > table > tbody > tr > td:first-child,
    .table-scroll-wrap > table > thead > tr > th:first-child,
    .table-scroll-wrap > table > tbody > tr > td:first-child {
        position: sticky;
        left: 0;
        z-index: 2;
        background: #fff;
    }

    /* 4. Kalkulyator: tablica rascheta tozhe ne dolzhna rastyagivat stranicu */
    .wrap_table_calculator {
        overflow-x: auto;
        max-width: 100%;
    }
}

/* Ssylki bez podcherkivaniya (pravilo vladeltca) */
a, a:hover, a:focus, a:active { text-decoration: none; }
a { border-bottom: 0; }

/* Kartinki ne dolzhny vylezat za predely bloka.
   Ranshe eto pravilo prihodilo iz media/modals/css/bootstrap.min.css (ego ubrali
   pri perehode na strukturu css/js), poetomu perenosim syuda. */
img { max-width: 100%; height: auto; }

/* ============================================
   Мобильное меню (функционал как на alfa.yantary.ru)
   Кнопка-бургер — в шапке, панель и затемнение — parts/mobile.php
   ============================================ */
.burger-btn {
    display: none;                 /* pokazyvaem tolko na uzkih ekranah */
    position: fixed;               /* fixirovan sprava sverhu */
    top: 10px;
    right: 12px;
    z-index: 10060;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 12px;
    background: #186bbb;
    cursor: pointer;
    transition: background .2s ease;
}
.burger-btn:hover { background: #0e4f8f; }
.burger-btn span {
    display: block;
    width: 22px;
    height: 2px;
    margin: 2.5px 0;
    background: #fff;
    border-radius: 2px;
    transition: transform .3s ease, opacity .2s ease;
}
.burger-btn.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger-btn.active span:nth-child(2) { opacity: 0; }
.burger-btn.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.menu-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 32, 56, .45);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    z-index: 10040;
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease, visibility .3s ease;
}
.menu-overlay.active { opacity: 1; visibility: visible; }

.mobile-menu {
    position: fixed;
    top: 0;
    right: 0;
    width: 330px;
    max-width: 88%;
    height: 100vh;
    height: 100dvh;
    /* display:none v zakrytom sostoyanii: inache panel, sdvinutaya za kraj ekrana,
       sozdaet gorizontalnuyu prokrutku vsej stranicy */
    display: none;
    flex-direction: column;
    background: linear-gradient(160deg, #186bbb 0%, #0e4f8f 100%);
    box-shadow: -8px 0 30px rgba(0, 0, 0, .18);
    z-index: 10050;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.mobile-menu.active {
    display: flex;
    animation: mm-slide-in .32s ease both;
}
.mobile-menu.closing {
    display: flex;
    animation: mm-slide-out .28s ease both;
}
@keyframes mm-slide-in {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}
@keyframes mm-slide-out {
    from { transform: translateX(0); }
    to   { transform: translateX(100%); }
}

.mobile-menu-head {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
}
.mobile-menu-close {
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 26px;
    line-height: 1;
    cursor: pointer;
    transition: background .2s ease;
}
.mobile-menu-close:hover { background: rgba(255, 255, 255, .24); }

.menu-list {
    list-style: none;
    margin: 0;
    padding: 10px 12px 20px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
}
.menu-list li a,
.menu-list li .menu-toggle {
    display: block;
    padding: 11px 14px;
    color: #fff;
    font-size: 17px;
    line-height: 1.25;
    text-decoration: none;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s ease;
}
.menu-list li a:hover,
.menu-list li .menu-toggle:hover,
.menu-list li a.current { background: rgba(255, 255, 255, .16); }
.menu-list li.has-submenu.current > .menu-toggle { background: rgba(255, 255, 255, .12); }
.menu-toggle { display: flex !important; align-items: center; justify-content: space-between; }
.menu-arrow { font-size: 18px; opacity: .85; }

.sub-menu {
    list-style: none;
    margin: 0;
    padding: 0 0 0 12px;
    max-height: 0;
    overflow: hidden;
    transition: max-height .35s ease;
}
.sub-menu.active { max-height: 800px; }
.sub-menu li a { font-size: 15px; padding: 8px 14px; color: rgba(255, 255, 255, .88); }

.mobile-menu-foot {
    padding: 16px;
    border-top: 1px solid rgba(255, 255, 255, .16);
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mobile-menu-foot .mm-phone { color: #fff; font-size: 18px; font-weight: 600; text-decoration: none; }

/* Knopka "sdelat raschet" v shapke: prozrachnaya s beloj ramkoj */
.headinfo-order a {
    text-transform: lowercase;
    background: transparent;
    border: 2px solid #fff;
    padding: 8px 20px 9px;
    border-radius: 30px;
}
.headinfo-order a:hover {
    background: #fff;
    color: #186bbb;
}

/* Do 1024 - burger vmesto obychnogo menyu, vyshe - obychnoe menyu */
@media screen and (max-width: 1024px) {
    #menu { display: none; }          /* vmesto obychnogo menyu - burger */
    .burger-btn { display: flex; }
    /* otstup sprava, chtoby fiksirovannaya knopka menyu ne perekryvala soderzhimoe shapki */
    .head-before-inner { padding-right: 60px; }

    /* v shapke ostavlyaem tolko poisk: yazyki, kontakty i knopku ubiraem */
    #headlang,
    .headinfo-order,
    .headinfo-links { display: none !important; }
    .head-before-inner { align-items: center; }
    .headinfo-box { width: 100%; }

    /* logotip po centru */
    .header-inner { justify-content: center; }
    #head { width: 100%; display: flex; justify-content: center; }
    .head-inner .custom p { text-align: center; }
}

/* Poisk vsegda viden. V shablone na <=686px on stanovitsya position:absolute,
   kontejner shlopyvaetsya v nulevuyu shirinu i poisk uezzhaet za ekran. */
@media screen and (max-width: 686px) {
    .headinfo-search {
        position: static !important;
        top: auto !important;
        left: auto !important;
        width: 100% !important;
        max-width: 100% !important;
    }
    .headinfo-box {
        flex-direction: column !important;
        align-items: stretch;
        padding-bottom: 0 !important;
        width: 100%;
    }
}

/* Poisk ne dolzhen uhodit za ekran na ochen uzkih ekranah:
   u modulya zhestko zadana shirina (330-400px) */
@media screen and (max-width: 480px) {
    .headinfo-search,
    .headinfo-search .mls-form,
    .headinfo-search .mls-form-inner,
    .headinfo-search .mls-parent,
    .headinfo-search input.mls-query,
    .headinfo-search .mls-results-cont,
    .headinfo-search .mls-results {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box;
        left: 0 !important;
    }
}
@media screen and (min-width: 1025px) {
    .mobile-menu, .menu-overlay, .burger-btn { display: none !important; }
}

/* Shapka ne fiksiruetsya pri prokrutke (v shablone stoyal position:sticky) */
.head-before { position: static; }

/* Shapka tablic (thead) ne fiksiruetsya: v shablone stoyal position:sticky */
.table-head-sticky thead,
.table-with-scroll thead,
.tck-article-body thead {
    position: static;
    top: auto;
    z-index: auto;
}

/* Gradienty fona: shapka i podval */
.head-before {
    background: linear-gradient(135deg, #186BBB 0%, #315F8C 100%);
}
footer {
    background: linear-gradient(135deg, #186BBB 0%, #08427A 100%);
}
