/**
 * @file
 * Menu CSS file
 * Note this has media queries to be careful if you edit this.
 */

/* Main nav */

/* Hide the menu, it gets unhidden with JQuery when fully ready. */
.js #main-menu ul:first-child {
    display: none;
}

#menu-wrapper {
    background: #444;
    background: -moz-repeating-linear-gradient(#555, #333 42px);
    background: -webkit-repeating-linear-gradient(#555, #333 42px);
    background: -o-repeating-linear-gradient(#555, #333 42px);
    background: -ms-repeating-linear-gradient(#555, #333 42px);
    background: repeating-linear-gradient(#555, #333 42px);
    box-shadow: 0 0 3px #999;
}

#nav-wrap {
    position: relative;
}

#main-menu ul.menu.ul-depth-0 {
    margin-top: 20px;
}

/* menu icon */
#menu-icon {
    display: none;
}

#main-menu ul.menu.ul-depth-0,
#main-menu ul.menu.ul-depth-0 li {
    margin: 0;
    padding: 0;
}

#main-menu ul.menu.ul-depth-0 li {
    float: left;
    list-style: none;
    position: relative;
}

#main-menu ul.menu.ul-depth-0 li.expanded a {
    padding-right: 22px;
}

/* nav link */
#main-menu ul.menu.ul-depth-0 a {
    color: #fff;
    display: block;
    font-size: 1.1em;
    letter-spacing: .05em;
    padding: 5px 11px;
    font-weight: bold;
}

/* nav dropdown */

#main-menu ul.menu.ul-depth-0 ul {
    display: none;
    padding: 0;
    position: absolute;
    top: 34px;
    width: 208px;
    z-index: 300;
}

.body-font-serif #main-menu ul.menu.ul-depth-0 ul {
    top: 39px;
}

#main-menu ul.menu.ul-depth-0 ul li a {
    font-size: 1.05em;
    padding: 6px 9px;
}

.body-font-serif #main-menu ul.menu.ul-depth-0 ul li a {
    font-size: 1.1em;
    padding: 9px 9px;
}

#main-menu ul.menu.ul-depth-0 ul li {
    border-top: #ccc 1px solid;
    float: none;
    margin: 0;
    padding: 0;
}

#main-menu ul.menu.ul-depth-0 li:hover > ul {
    display: block;
}

#main-menu ul li li.last a {
    -moz-border-radius-bottomright: 9px;
    -webkit-border-bottom-right-radius: 9px;
    -moz-border-radius-bottomleft: 9px;
    -webkit-border-bottom-left-radius: 9px;
    border-radius: 0 0 9px 9px;
}

.tertiarymenu #main-menu ul li li.last a {
    -moz-border-radius-bottomright: 0;
    -webkit-border-bottom-right-radius: 0;
    -moz-border-radius-bottomleft: 0;
    -webkit-border-bottom-left-radius: 0;
    border-radius: 0;
}

#main-menu a:hover,
#main-menu li > a.active {
    background: #777;
    background: -moz-linear-gradient(#777, #555);
    background: -webkit-linear-gradient(#777, #555);
    background: -o-linear-gradient(#777, #555);
    background: -ms-linear-gradient(#777, #555);
    background: linear-gradient(#777, #555);
    color: #fff;
    text-decoration: none;
}

/* MOBILE */

@media screen and (max-width: 768px) {

    /* nav-wrap */
    #menu-wrapper {
        padding: 10px 15px;
    }

    #main-menu ul.menu.ul-depth-0-wrap {
        position: relative;
    }

    /* menu icon - аккуратное мобильное меню */
    #menu-icon {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        background: #f8f9fa;
        border: 1px solid #e9ecef;
        border-radius: 8px;
        color: #212529;
        cursor: pointer;
        padding: 12px 20px;
        font-size: 15px;
        font-weight: 600;
        transition: background 0.2s ease, border-color 0.2s ease;
    }

    #menu-icon:hover {
        background: #e9ecef;
        border-color: #dee2e6;
    }

    #menu-icon.active {
        background: #e9ecef;
        border-color: #375a7f;
    }

    /* Иконка гамбургера (три полоски) — центрирована по высоте */
    .menu-icon-bars {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        align-items: stretch;
        width: 20px;
        height: 14px;
        background: linear-gradient(to bottom, transparent 5px, currentColor 5px, currentColor 7px, transparent 7px);
    }
    .menu-icon-bars::before,
    .menu-icon-bars::after {
        content: '';
        height: 2px;
        background: currentColor;
        border-radius: 1px;
    }

    .menu-icon-text {
        line-height: 1;
    }

    /* main nav — на всю ширину области (breakout под padding #menu-wrapper 15px) + внутренние поля, чтобы контент не прилипал к краям */
    /* !important: иначе на части страниц (Bootstrap / контент) перебивает display и панель видна без клика */
    #main-menu ul.menu.ul-depth-0 {
        background: #f8f8f8;
        border: solid 1px #999;
        box-sizing: border-box;
        clear: both;
        display: none !important;
        /*left: -15px;*/
        /*padding: 0 16px 12px;*/
        position: absolute;
        top: 38px;
        width: calc(100% + 30px);
        max-width: 100vw;
        z-index: 10000;
        /* Скролл внутри панели: иначе жест скроллит страницу и после touch срабатывает «клик вне меню» — панель закрывается */
        max-height: min(75vh, 32rem);
        max-height: min(75dvh, 32rem);
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        touch-action: pan-y;
    }

    /* Пока открыто мобильное меню — не даём скроллить body (иначе тот же эффект ложного клика) */
    html:has(#menu-icon.active),
    body:has(#menu-icon.active) {
        overflow: hidden;
        overscroll-behavior: none;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu {
        border-bottom: 2px solid rgba(0, 0, 0, 0.1);
        clear: both;
        float: none;
        margin: 0;
        width: 100%;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .mobile-user-menu-panel {
        border-left: none;
        border-radius: 0;
        border-right: none;
        border-top: none;
        box-shadow: none;
        margin: 0;
        padding: 14px 12px 16px;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .user-info {
        border-radius: 0;
        box-sizing: border-box;
        width: 100%;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .user-info .user-info-profile-link {
        color: #212529;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .user-info .user-info-profile-link:hover {
        color: #0d6efd;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .user-info .user-info-logout {
        color: #c62828;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .user-info .user-info-logout:hover {
        color: #b71c1c;
    }

    #main-menu ul.menu.ul-depth-0 > li.mobile-user-menu .mobile-user-menu-label {
        padding-left: 4px;
    }

    #main-menu ul.menu.ul-depth-0 > li:not(.mobile-user-menu) {
        clear: both;
        float: none;
        margin: 10px 0 0 15px;
    }

    #main-menu ul.menu.ul-depth-0 a,
    #main-menu ul.menu.ul-depth-0 ul a {
        background: none;
        border: none;
        color: #667;
        display: inline;
        font: inherit;
        padding: 0;
    }

    #main-menu ul.menu.ul-depth-0 a:hover,
    #main-menu ul.menu.ul-depth-0 ul a:hover {
        background: none;
        color: #000;
    }

    /* dropdown: подпункты раскрыты внутри открытой панели */
    #main-menu ul.menu.ul-depth-0 ul {
        background: inherit;
        border: none;
        display: block;
        position: static;
        width: auto;
    }

    #main-menu ul.menu.ul-depth-0 ul li {
        margin: 4px 0 4px 12px;
    }

    #main-menu li.leaf.active-trail a {
        background: #ccc;
    }

}

@media screen and (min-width: 769px) {

    #main-menu ul.menu.ul-depth-0 {
        display: block !important;
    }

    #main-menu ul.menu.ul-depth-0 a:hover,
    #main-menu ul.menu.ul-depth-0 li > a.active {
        color: #fff;
    }

    span.drop-arrow {
        background: url('../images/arrows-ffffff.png') 10px -100px;
        display: block;
        height: 10px;
        position: absolute;
        right: 5px;
        top: 13px;
        width: 11px;
        z-index: 1;
    }

    .menu.ul-depth-1 span.drop-arrow {
        background: url('../images/arrows-right.png') 10px -2px;
    }

    #main-menu ul.menu.ul-depth-0 li.expanded.active-trail {
        background: #777;
        background: -moz-linear-gradient(#777, #555);
        background: -webkit-linear-gradient(#777, #555);
        background: -o-linear-gradient(#777, #555);
        background: -ms-linear-gradient(#777, #555);
        background: linear-gradient(#777, #555);
        color: #fff;
    }

    #main-menu ul.menu.ul-depth-2 li {
        border-left: 1px dotted #667;
        left: 207px;
        position: relative;
        top: -42px;
    }

    #main-menu ul.menu.ul-depth-2 li a {
        -moz-border-radius-bottomright: 0;
        -webkit-border-bottom-right-radius: 0;
        -moz-border-radius-bottomleft: 0;
        -webkit-border-bottom-left-radius: 0;
        border-radius: 0;
    }

}

nav#main-menu ul li li a {
    background: #01799e;
}

nav#main-menu ul li li a:hover {
    background: #999;
}

.menu-navigation-container li a {
    text-transform: uppercase;
}

.menu-navigation-container li li a {
    text-transform: capitalize;
}

body.body-font-serif .menu-navigation-container ul.menu li a {
    letter-spacing: .14em;
}

#main-menu li li a,
#main-menu li li a:link,
#main-menu li li a:visited {
    /*background-color: #152d43;*/
    letter-spacing: 0;
}

.date-in-parts {
    background: #01799e;
}

#bottom {
    background: #4e4554;
}

#copyright {
    background: #3e3742;
}

.form-submit {
    background-color: #ccc;
    color: #333;
}



/* Меню пользователя */

/* Десктопное меню */
.desktop-user-menu {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    padding-right: 15px;
}

/* Гостевое меню */
.user-menu-guest {
    display: flex;
    align-items: center;
    gap: 10px;
}

.user-menu-link {
    color: #fff;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s ease;
    padding: 8px 12px;
    border-radius: 4px;
}

.user-menu-link:hover {
    color: #07acdb;
    background-color: rgba(255, 255, 255, 0.1);
}

.user-menu-separator {
    color: rgba(255, 255, 255, 0.5);
    font-size: 16px;
}

/* Меню авторизованного пользователя */
.user-menu-logged {
    position: relative;
}

.user-menu-dropdown {
    position: relative;
}

.user-menu-toggle {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 25px;
    padding: 6px 15px 6px 6px;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
}

.user-menu-toggle:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.3);
}

.user-menu-toggle.active {
    background: rgba(255, 255, 255, 0.2);
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    object-fit: cover;
}

.user-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: #000;
}

.user-menu-dropdown .user-name {
    color: #FFF;
}

.dropdown-arrow {
    transition: transform 0.2s ease;
}

.user-menu-toggle.active .dropdown-arrow {
    transform: rotate(180deg);
}

/* Выпадающее меню */
.user-dropdown-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    min-width: 220px;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all 0.2s ease;
    z-index: 1000;
}

.user-dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: background-color 0.2s ease;
}

.dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
}

.dropdown-item:hover {
    background-color: #f5f5f5;
    color: #0066aa;
}

.dropdown-item svg {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
}

.dropdown-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

/* Подменю «Создать материал» в user-dropdown */
.dropdown-create-toggle {
    width: 100%;
    border: none;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.dropdown-create-toggle-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-create-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #666;
}

.dropdown-create-submenu.is-open .dropdown-create-chevron,
.mobile-create-submenu.is-open .mobile-create-chevron {
    transform: rotate(180deg);
}

.dropdown-create-items {
    display: none;
    background-color: #f8f9fa;
    padding: 4px 0;
}

.dropdown-create-submenu.is-open .dropdown-create-items {
    display: block;
}

.dropdown-item.dropdown-subitem {
    padding-left: 40px;
    font-size: 13px;
}

.dropdown-item.dropdown-subitem:hover {
    background-color: #eceff1;
}

.mobile-create-submenu {
    margin-bottom: 3px;
}

.mobile-create-toggle {
    width: 100%;
    cursor: pointer;
    text-align: left;
    font: inherit;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-create-toggle--static {
    cursor: default;
    justify-content: flex-start;
}

.mobile-create-toggle:not(.mobile-user-menu-action--toggle) {
    border: none;
    background-color: rgba(255, 255, 255, 0.05);
    color: #fff;
    padding: 10px 15px;
    border-radius: 4px;
}

.mobile-create-toggle:not(.mobile-user-menu-action--toggle):hover {
    background-color: rgba(255, 255, 255, 0.15);
}

.mobile-create-toggle-main {
    display: flex;
    align-items: center;
    gap: 10px;
}

.mobile-create-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    opacity: 0.85;
}

.mobile-create-items {
    display: none;
    padding-left: 12px;
}

.mobile-create-submenu.is-open .mobile-create-items {
    display: block;
}

.logout-item {
    color: #d32f2f;
}

.logout-item:hover {
    background-color: #ffebee;
    color: #c62828;
}

/* Мобильное меню пользователя (встроенное в главное меню) */
.mobile-user-menu {
    clear: both;
    display: none;
}

.mobile-user-menu-panel {
    background-color: #eceff1;
    border-radius: 10px;
    padding: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    border: 1px solid rgba(0, 0, 0, 0.08);
    margin: 4px 0 12px;
}

.mobile-user-menu-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #6c757d;
    margin-bottom: 10px;
    padding-left: 2px;
    font-weight: 600;
}

/* Единый вид строк меню: иконка + текст */
.mobile-user-menu-panel .mobile-user-menu-action {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    box-sizing: border-box;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: #fff;
    color: #212529;
    border: 1px solid #dee2e6;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
    line-height: 1.3;
}

.mobile-user-menu-panel .mobile-user-menu-action svg {
    flex-shrink: 0;
    color: #495057;
}

.mobile-user-menu-panel a.mobile-user-menu-action:hover,
.mobile-user-menu-panel button.mobile-user-menu-action--toggle:hover,
.mobile-user-menu-panel div.mobile-user-menu-action:hover {
    background: #f8f9fa;
    color: #212529;
    border-color: #ced4da;
}

.mobile-user-menu-panel button.mobile-user-menu-action--toggle {
    border: 1px solid #dee2e6;
    margin-bottom: 4px;
}

.mobile-user-menu-panel .logout-item.mobile-user-menu-action {
    color: #c62828;
    border-color: rgba(198, 40, 40, 0.35);
}

.mobile-user-menu-panel .logout-item.mobile-user-menu-action svg {
    color: #c62828;
}

.mobile-user-menu-panel .logout-item.mobile-user-menu-action:hover {
    background: #ffebee;
    color: #b71c1c;
    border-color: rgba(198, 40, 40, 0.45);
}

.mobile-user-menu .user-menu-guest {
    display: flex;
    flex-direction: column;
    gap: 5px;
    padding: 0;
}

.mobile-user-menu-panel .user-menu-link {
    display: flex;
    align-items: center;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    padding: 10px 12px;
    margin-bottom: 4px;
    border-radius: 6px;
    background: #fff;
    color: #212529;
    border: 1px solid #dee2e6;
    text-decoration: none;
    font-size: 15px;
    font-weight: 500;
}

.mobile-user-menu-panel .user-menu-link:hover {
    background: #f8f9fa;
    color: #212529;
    border-color: #ced4da;
}

.mobile-user-menu .user-menu-separator {
    display: none;
}

.mobile-user-menu-panel .user-info {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 12px;
    background: #fff;
    border: 1px solid #dee2e6;
    border-radius: 6px;
    margin-bottom: 10px;
    color: #212529;
}

.mobile-user-menu-panel .user-info .user-info-profile-link {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
    text-decoration: none;
    color: #212529;
    border: none;
    background: none;
    padding: 0;
}

.mobile-user-menu-panel .user-info .user-info-profile-link:hover {
    color: #0d6efd;
}

.mobile-user-menu-panel .user-info .user-info-profile-link:hover .user-name {
    text-decoration: underline;
}

.mobile-user-menu-panel .user-info .user-name {
    font-weight: 600;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.mobile-user-menu-panel .user-info .user-info-logout {
    font-size: 14px;
    font-weight: 500;
    color: #c62828;
    text-decoration: none;
    border: none;
    background: none;
    padding: 0;
    cursor: pointer;
    flex-shrink: 0;
    align-self: center;
    white-space: nowrap;
}

.mobile-user-menu-panel .user-info .user-info-logout:hover {
    color: #b71c1c;
    text-decoration: underline;
}

.mobile-user-menu .user-info .user-avatar-small {
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border-radius: 50%;
    object-fit: cover;
}

.mobile-user-menu-panel .dropdown-divider {
    background-color: rgba(0, 0, 0, 0.1);
    margin: 8px 4px;
    height: 1px;
}

.mobile-user-menu-panel .mobile-create-items .dropdown-item.dropdown-subitem {
    background: #f8f9fa;
    border-color: #e9ecef;
    font-size: 14px;
    padding-left: 14px;
    margin-bottom: 3px;
}

.mobile-user-menu-panel .mobile-create-items .dropdown-item.dropdown-subitem:hover {
    background: #e9ecef;
    color: #212529;
}

.mobile-user-menu-panel .mobile-create-chevron {
    color: #6c757d;
}

/* Адаптивность */
@media (max-width: 768px) {
    .desktop-user-menu {
        display: none !important;
    }

    .mobile-user-menu {
        display: block;
    }
}

@media (min-width: 769px) {
    .mobile-user-menu {
        display: none !important;
    }
}