/* Меню и окно входа в общей шапке.
   Стили вынесены сюда, чтобы инлайновые скрипты страниц не разрастались
   и окно входа выглядело одинаково на всех страницах. */

.header-menu {
    position: relative;
    justify-self: end;
}

/* author-стиль display должен явно проигрывать атрибуту hidden:
   браузерный [hidden] из UA-таблицы слабее .ha-menu-panel { display: flex }. */
.ha-menu[hidden],
.ha-menu-panel[hidden],
.ha-menu-item[hidden],
.ha-auth-panel[hidden],
.ha-auth-tabs[hidden],
.ha-modal[hidden] {
    display: none !important;
}

.ha-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 15px;
    min-width: 180px;
    background: linear-gradient(135deg, #1e3a5f, #1a4a6e);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    z-index: 1200;
}

.ha-menu-panel {
    display: flex;
    flex-direction: column;
}

.ha-menu-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    background: none;
    border: 0;
    color: #fff;
    font: inherit;
    font-size: 0.85rem;
    text-align: left;
    cursor: pointer;
    transition: background 0.2s;
}

.ha-menu-item:hover,
.ha-menu-item:focus-visible {
    background: rgba(79, 195, 247, 0.2);
    outline: none;
}

.ha-menu-item i {
    width: 18px;
    font-size: 0.9rem;
}

.ha-menu-user {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 16px;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    background: linear-gradient(135deg, rgba(79, 195, 247, 0.2), rgba(79, 195, 247, 0.05));
    border-bottom: 2px solid #4fc3f7;
    pointer-events: none;
}

.ha-menu-user i {
    font-size: 1.1rem;
    color: #4fc3f7;
}

.ha-menu-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

/* Окно входа: та же механика, что на info.html — вход, регистрация, код. */
.ha-modal {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(8px);
    z-index: 2000;
}

.ha-modal-content {
    background: linear-gradient(135deg, #1e3a5f, #1a4a6e);
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    padding: 30px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    animation: haModalFadeIn 0.3s ease;
}

@keyframes haModalFadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.ha-modal-close {
    position: absolute;
    top: 10px;
    right: 16px;
    background: none;
    border: 0;
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.8rem;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
}

.ha-modal-close:hover {
    color: #4fc3f7;
    transform: scale(1.1);
}

.ha-modal h3 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
    color: #4fc3f7;
}

.ha-auth-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    padding-bottom: 10px;
}

.ha-auth-tab {
    flex: 1;
    padding: 8px;
    background: none;
    border: 0;
    border-radius: 8px;
    color: rgba(255, 255, 255, 0.6);
    font: inherit;
    cursor: pointer;
    transition: background 0.3s, color 0.3s;
}

.ha-auth-tab.active {
    background: rgba(79, 195, 247, 0.2);
    color: #4fc3f7;
}

.ha-auth-tab:hover:not(.active) {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.ha-form-group {
    margin-bottom: 20px;
}

.ha-form-group label {
    display: block;
    margin-bottom: 8px;
    font-size: 0.9rem;
    opacity: 0.9;
}

.ha-input {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    border: none;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font: inherit;
    font-size: 1rem;
    transition: background 0.3s, box-shadow 0.3s;
}

.ha-input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.25);
    box-shadow: 0 0 0 2px #4fc3f7;
}

.ha-input::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

.ha-submit {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #4fc3f7, #2c7ab1);
    border: none;
    border-radius: 10px;
    color: #fff;
    font: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.3s, opacity 0.3s;
}

.ha-submit:active {
    transform: scale(0.98);
}

.ha-submit:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.ha-error {
    color: #ff6b6b;
    font-size: 0.85rem;
    margin-top: 12px;
    text-align: center;
}

/* Ссылки внутри панелей окна («Забыли пароль?», «Назад»). */
.ha-link {
    display: block;
    width: 100%;
    margin-top: 10px;
    padding: 4px 0;
    background: none;
    border: 0;
    color: #4fc3f7;
    font: inherit;
    font-size: 0.85rem;
    text-align: center;
    text-decoration: underline;
    cursor: pointer;
}

.ha-link:hover,
.ha-link:focus-visible {
    color: #fff;
    outline: none;
}

.ha-verification {
    background: rgba(79, 195, 247, 0.1);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    text-align: center;
}

.ha-toast {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(79, 195, 247, 0.9);
    color: #1a3a5f;
    padding: 12px 24px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.9rem;
    z-index: 3000;
    backdrop-filter: blur(8px);
    opacity: 1;
    transition: opacity 0.3s;
}

.ha-toast.is-error {
    background: rgba(255, 107, 107, 0.9);
}

.ha-toast.is-hiding {
    opacity: 0;
}

@media (max-width: 480px) {
    .ha-menu {
        min-width: 165px;
    }

    .ha-modal-content {
        padding: 24px 20px;
    }
}
