/* Стили для хедера главной страницы */

.header {
    background: var(--color-primary, #132431);
    color: var(--color-bg-white, #ffffff);
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-sizing: border-box;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    position: sticky;
    top: 0;
    z-index: 10;
    padding-left: 32px;
    padding-right: 32px;
    height: 110px;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.header-left {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.header img {
    height: 66px;
    width: auto;
}

.branding {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.branding-title {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 0.04em;
}

.branding-subtitle {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 15px;
    font-weight: 500;
    opacity: 0.7;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.header-center {
    text-align: center;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: center;
    justify-content: center;
}

.header-center-title {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0;
}

.header-actions {
    min-width: 240px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    position: relative;
}

.header-user {
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 18px;
    font-weight: 500;
    opacity: 0.85;
}

.logout-form {
    margin: 0;
}

/* Кнопки в хедере: одинаковая высота у «Выйти» и «Админка» */
.logout-btn, .admin-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    height: 36px;
    min-height: 36px;
    box-sizing: border-box;
    border-radius: 10px;
    font-family: 'Source Sans 3', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: #ffffff;
    justify-content: center;
}

.logout-btn:hover, .admin-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.5);
}

.logout-btn img {
    width: 17px;
    height: 17px;
    flex-shrink: 0;
    object-fit: contain;
}

.logout-btn p {
    margin: 0;
    white-space: nowrap;
}

.admin-btn {
    background-color: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

.admin-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

/* Иконка шестерёнки: по умолчанию скрыта, показываем текст «Админка» */
.admin-btn-icon {
    display: none;
}

.admin-btn-text {
    display: inline;
}

/* Адаптивность для планшетов */
@media (max-width: 1024px) {
    .header {
        padding-left: 24px;
        padding-right: 24px;
        height: auto;
        min-height: 110px;
        align-items: center;
    }
    
    .header-actions {
        min-width: 200px;
        gap: 12px;
        align-items: center;
    }
    
    .logout-form {
        display: flex;
        align-items: center;
    }
    
    .branding-title {
        font-size: 22px;
    }
    
    .branding-subtitle {
        font-size: 13px;
    }
    
    .header img {
        height: 56px;
    }
    
    .logout-btn, .admin-btn {
        height: 36px;
        min-height: 36px;
        padding: 0 16px;
    }
}

/* Адаптивность для мобильных устройств (768px — 320px): один макет как на 320 */
@media (max-width: 768px) {
    .header {
        display: grid;
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        align-items: start;
        height: auto;
        padding: 24px;
        gap: 0;
    }
    
    /* Первая строка: header-center слева, header-actions справа — всегда в одной строке */
    .header-center {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
        text-align: left;
        align-items: flex-start;
        padding: 0;
        margin: 0;
        margin-bottom: 12px;
        display: flex;
        flex-direction: column;
    }
    
    .header-center img {
        height: 37.6px;
        width: auto;
    }
    
    .header-actions {
        grid-column: 2;
        grid-row: 1;
        justify-self: end;
        min-width: auto;
        justify-content: flex-end;
        padding: 0;
        display: flex;
        align-items: center;
        margin-bottom: 12px;
    }
    
    /* Вторая строка: header-left на всю ширину */
    .header-left {
        grid-column: 1 / -1;
        grid-row: 2;
        align-items: center;
        border-top: 1px solid rgba(255, 255, 255, 0.7);
        padding-top: 12px;
    }
    
    .branding-title {
        font-size: 18px;
    }
    
    .branding-subtitle {
        font-size: 11px;
    }
    
    .logout-btn, .admin-btn {
        font-size: 13px;
        height: 36px;
        min-height: 36px;
        padding: 0 10px;
    }
    
    .logout-btn p {
        display: inline;
        white-space: nowrap;
        font-size: 11px;
    }
    
    .logout-btn img {
        width: 16px;
        height: 16px;
    }
    
    .header-user {
        font-size: 14px;
    }
}

/* Только на 320px: ограничение ника многоточием */
@media (max-width: 320px) {
    .header-user {
        max-width: 43px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

/* На 320px и узких экранах: шестерёнка вместо «Админка», у «Выйти» только иконка, кнопки одного размера */
@media (max-width: 480px) {
    /* Кнопка «Выйти» — только иконка, без надписи */
    .logout-btn p {
        display: none;
    }

    .logout-btn, .admin-btn {
        height: 36px;
        min-height: 36px;
        padding: 0 8px;
        min-width: 36px;
        justify-content: center;
    }

    .logout-btn img {
        width: 16px;
        height: 16px;
    }

    /* Кнопка «Админка» — только шестерёнка, такой же размер как «Выйти» */
    .admin-btn-icon {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .admin-btn-icon svg {
        width: 16px;
        height: 16px;
    }

    .admin-btn-text {
        display: none;
    }
}
