/* 
 * Стили навигации для системы видео разметки
 * Централизованные стили для всех страниц
 */

/* Базовые стили навигации - анимированный хедер для всех страниц */
header.main-header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 70px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 20px;
    overflow: visible;
    z-index: 998;
    opacity: 0;
    transform: translateY(-100%);
    transition: transform 0.3s ease-out,
                opacity 0.3s ease-in-out,
                box-shadow 0.3s ease-in-out;
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

/* Сенсорная область для анимированного хедера */
.header-sensor {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 20px;
    z-index: 999;
    pointer-events: none;
}

/* Опционально: тонкая линия-подсказка наверху (можно убрать) */
.header-sensor::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 1px;
    background: rgba(102, 126, 234, 0.3);
    opacity: 0;
    transition: opacity 0.2s ease;
}

body:hover .header-sensor::after {
    opacity: 1;
}

header.main-header.hidden {
    opacity: 0;
    transform: translateY(-100%);
    box-shadow: 0 0 0 rgba(0, 0, 0, 0);
}

header.main-header.visible {
    transform: translateY(0);
    opacity: 1;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.15);
}

/* Логотип — explicit line-height so page typography (main.css h1) cannot shrink it */
header.main-header .logo {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    min-height: 38px;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

header.main-header .logo:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 4px;
    border-radius: 4px;
}

header.main-header .logo h1 {
    font-size: 1.5rem;
    line-height: 1.2;
    margin: 0;
    font-weight: 600;
    color: #ffffff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

header.main-header .logo i {
    font-size: 1.8rem;
    line-height: 1;
    color: #ffd700;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.2));
}

/*
 * Navigation must stay content-sized (no flex-grow).
 * Growing the nav pulled group links to the left of the header after the
 * language select was added; space-between on the header places the compact
 * group between logo and auth again.
 */
header.main-header .navigation {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 1 auto;
    min-width: 0;
    flex-wrap: nowrap;
    overflow: visible;
    max-width: calc(100vw - 560px);
    padding: 2px 0;
}

.nav-dropdown {
    position: relative;
    flex: 0 0 auto;
}

.nav-dropdown-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    box-sizing: border-box;
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(0, 0, 0, 0.12);
    color: rgba(255, 255, 255, 0.96);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.nav-dropdown-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.45);
}

.nav-dropdown-toggle .group-icon {
    font-size: 14px;
}

.nav-dropdown-toggle .dropdown-caret {
    font-size: 11px;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.nav-dropdown.active .nav-dropdown-toggle {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.45);
}

.nav-dropdown.open .nav-dropdown-toggle .dropdown-caret {
    transform: rotate(180deg);
}

.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 240px;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 20, 35, 0.96);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-6px);
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 1001;
}

.nav-dropdown.open .nav-dropdown-menu {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-dropdown-menu .nav-link {
    width: 100%;
    padding: 9px 10px;
    font-size: 13px;
    color: rgba(255, 255, 255, 0.92);
    transform: none;
}

.nav-dropdown-menu .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.14);
    transform: none;
}

.nav-dropdown-menu .nav-link.active {
    background-color: rgba(102, 126, 234, 0.45);
    box-shadow: none;
}

.nav-dropdown-menu .nav-link i {
    font-size: 14px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 8px;
    height: 38px;
    box-sizing: border-box;
    padding: 10px 15px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    border-radius: 6px;
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: 500;
    position: relative;
    overflow: hidden;
}

.nav-link::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.nav-link:hover::before {
    left: 100%;
}

.nav-link:hover {
    color: white;
    background-color: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.nav-link.active {
    color: white;
    background-color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.nav-link i {
    font-size: 16px;
    min-width: 16px;
}

/* Контейнер аутентификации — только в shared header chrome */
header.main-header .auth-container {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 0 0 auto;
    overflow: visible;
    position: relative;
    z-index: 2;
}

.lang-switcher {
    display: inline-flex;
    align-items: center;
    position: relative;
}

.lang-select {
    display: inline-flex;
    align-items: center;
}

.lang-select-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-sizing: border-box;
    min-width: 138px;
    height: 38px;
    padding: 9px 12px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.12);
    color: rgba(255, 255, 255, 0.96);
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease;
}

.lang-select-toggle:hover {
    background: rgba(255, 255, 255, 0.16);
    border-color: rgba(255, 255, 255, 0.45);
}

.lang-select-toggle:focus-visible {
    outline: 2px solid #ffd700;
    outline-offset: 1px;
}

.lang-select-value {
    flex: 1;
    text-align: left;
}

.lang-select-caret {
    margin-left: auto;
    font-size: 11px;
    opacity: 0.9;
    transition: transform 0.2s ease;
}

.lang-select.open .lang-select-caret {
    transform: rotate(180deg);
}

.lang-select-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 100%;
    padding: 8px;
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.22);
    background: rgba(15, 20, 35, 0.96);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(8px);
    opacity: 0;
    transform: translateY(-6px);
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
    z-index: 1100;
}

.lang-select.open .lang-select-menu {
    opacity: 1;
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
}

.lang-select-option {
    display: block;
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: background 0.2s ease, color 0.2s ease;
}

.lang-select-option:hover {
    background: rgba(255, 255, 255, 0.14);
}

.lang-select-option.is-active,
.lang-select-option[aria-selected="true"] {
    background: rgba(255, 255, 255, 0.92);
    color: #5b4bce;
}

.lang-select-option:focus-visible {
    outline: 2px solid #ffd700;
    outline-offset: 1px;
}

.login-lang-switcher {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 2;
}

.user-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 14px;
    opacity: 0;
    animation: fadeInRight 0.5s ease forwards;
}

@keyframes fadeInRight {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.user-name {
    font-weight: 600;
    margin-bottom: 2px;
    color: #ffffff;
}

.user-role {
    font-size: 12px;
    opacity: 0.9;
    background-color: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

/* Кнопки аутентификации */
.auth-buttons {
    display: flex;
    gap: 10px;
}

header.main-header .auth-button {
    padding: 8px 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 5px;
    color: white;
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    transition: background-color 0.3s ease, border-color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    background: transparent;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

header.main-header .auth-button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: rgba(255, 255, 255, 0.1);
    transition: left 0.3s;
}

header.main-header .auth-button:hover::before {
    left: 100%;
}

header.main-header .auth-button:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

header.main-header .auth-button.login-button:hover {
    background-color: rgba(40, 167, 69, 0.8);
    border-color: rgba(40, 167, 69, 0.8);
}

header.main-header .auth-button.docs-header-button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.35);
}

header.main-header .auth-button.docs-header-button.active {
    background: rgba(255, 255, 255, 0.3);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.5);
}

header.main-header .auth-button.logout-button {
    background-color: rgba(220, 53, 69, 0.8);
    border-color: rgba(220, 53, 69, 0.8);
}

header.main-header .auth-button.logout-button:hover {
    background-color: rgba(220, 53, 69, 1);
    border-color: rgba(220, 53, 69, 1);
}

/* Убираем отступы для всех страниц - анимированный хедер не требует отступа */
.main-content,
main,
#app-container,
.no-header-padding .main-content,
.no-header-padding main,
.no-header-padding #app-container {
    padding-top: 20px;
}

/* Адаптивные стили */
@media (max-width: 768px) {
    header.main-header {
        padding: 0 15px;
        height: 60px;
    }

    header.main-header .logo h1 {
        font-size: 1.3rem;
    }

    header.main-header .navigation {
        gap: 2px;
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }

    header.main-header .navigation::-webkit-scrollbar {
        display: none;
    }

    .nav-dropdown-toggle,
    .lang-select-toggle {
        height: 34px;
        padding: 8px 10px;
        font-size: 12px;
        gap: 6px;
    }

    .lang-select-toggle {
        min-width: 110px;
    }

    .nav-dropdown-toggle .group-icon {
        display: none;
    }

    .nav-dropdown-menu {
        position: fixed;
        top: 66px;
        left: 10px;
        right: 10px;
        min-width: 0;
        max-height: 55vh;
        overflow-y: auto;
    }

    .navigation > .nav-link span {
        display: none;
    }

    .nav-link {
        height: 34px;
        padding: 8px 10px;
        font-size: 13px;
    }

    .nav-dropdown-menu .nav-link span {
        display: inline;
    }

    .user-info {
        display: none;
    }

    header.main-header .auth-button {
        padding: 6px 12px;
        font-size: 13px;
    }

    .main-content,
    main,
    #app-container {
        padding-top: 20px;
    }
}

@media (max-width: 480px) {
    header.main-header {
        padding: 0 10px;
        height: 55px;
    }

    header.main-header .logo h1 {
        font-size: 1.1rem;
    }

    header.main-header .logo i {
        font-size: 1.5rem;
    }

    .nav-link {
        height: 30px;
        padding: 6px 8px;
        font-size: 12px;
    }

    .nav-dropdown-toggle,
    .lang-select-toggle {
        height: 30px;
        padding: 6px 8px;
        font-size: 11px;
    }

    .lang-select-toggle {
        min-width: 96px;
    }

    .nav-dropdown-menu {
        top: 60px;
        left: 8px;
        right: 8px;
    }

    .nav-link i {
        font-size: 14px;
    }

    header.main-header .auth-button {
        padding: 5px 10px;
        font-size: 12px;
    }

    .main-content,
    main,
    #app-container {
        padding-top: 20px;
    }
}

/* Темы для разных ролей (опционально) */
.role-admin header.main-header {
    background: linear-gradient(135deg, #dc3545 0%, #6f42c1 100%);
}

.role-super-admin header.main-header {
    background: linear-gradient(135deg, #fd7e14 0%, #dc3545 100%);
}

.role-manager header.main-header {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
}

/* Анимации загрузки */
.navigation-loading {
    opacity: 0.5;
    pointer-events: none;
}

.navigation-loading .nav-link {
    background: linear-gradient(90deg, rgba(255,255,255,0.1) 25%, rgba(255,255,255,0.2) 50%, rgba(255,255,255,0.1) 75%);
    background-size: 200% 100%;
    animation: shimmer 2s infinite;
}

@keyframes shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

/* Стили для индикаторов уведомлений */
.nav-link .notification-badge {
    position: absolute;
    top: 5px;
    right: 5px;
    background: #dc3545;
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* Доступность */
.nav-link:focus,
.nav-dropdown-toggle:focus,
.lang-select-toggle:focus,
header.main-header .auth-button:focus {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

/* Печать */
@media print {
    header.main-header {
        display: none;
    }
    
    .main-content,
    main,
    #app-container {
        padding-top: 0;
    }
} 
